1
使用interp2时,错误“下标索引必须是真正的正整数还是逻辑”意味着什么。 X,Y,Z,XI,YI都是相同长度的矢量。下标索引必须是实数正整数或逻辑与interp2
使用interp2时,错误“下标索引必须是真正的正整数还是逻辑”意味着什么。 X,Y,Z,XI,YI都是相同长度的矢量。下标索引必须是实数正整数或逻辑与interp2
这意味着您试图通过使用索引作为带有小数点或负数的数字来访问数组中的元素,或者甚至可能使用看起来像数字的字符串,例如“2”。
访问元素的唯一方法是使用正整数或逻辑(0或1)。
array = [1 2 3 4 5 6];
array(4) # returns 4th element of the array, 4.
mask = array > 3; # creates a mask of 0's and 1's (logicals).
array(mask) # return elements greater than 3, 4 5 6.
,但你不能做的:
array(2.0)
或其他任何东西比正整数或逻辑等。
亚历
另请参见[这个问题](http://stackoverflow.com/questions/20054047/subscript-indices-must-either-be-real-positive-integers-or-logicals-generic-sol )为[这个问题的通用解决方案](http://stackoverflow.com/a/20054048/983722)。 – 2013-11-27 15:41:24