logo
  • 教程列表
  • SO官方文檔
  • sub2ind
    • 將下標轉換為線性索引
    • 坑瀑布
  1. StackOverflow 文件
  2. Julia Language 教程
  3. sub2ind
  4. 坑瀑布

坑瀑布

Created: November-22, 2018

# no error, even the subscript is out of range.
julia> sub2ind((3,3), 3, 4)
12

通過比較索引,無法確定下標是否在陣列範圍內:

julia> sub2ind((3,3), -1, 2)
2

julia> 0 < sub2ind((3,3), -1, 2) <= 9
true
  • 將下標轉換為線性索引

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明