登录论坛

查看完整版本 : Matlab如何忽略第一个索引= 1


poster
2019-12-10, 20:41
下面的代码给我错误=下Subscript indices must either be real positive integers or logicals.因为使用FIND函数的第一个索引是i = 1,所以i-1给出负值。如何在不使用LOOP函数的情况下在i == 1时忽略

fid=fopen('data.txt'); A=textscan(fid,'%f%f%f%f'); fclose(fid); in = cell2mat(A); i = find(in(1:end,2)>20 & in(1:end,2) 20 & in(1:end,2) 1)); 顺便说一句,请小心使用i作为常规变量,因为您将覆盖以下默认值:

i = sqrt(-1)



更多&回答... (https://stackoverflow.com/questions/3083753)