Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
下面的代码给我错误=下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) 更多&回答... |
![]() |
![]() |