我的 Matlab 代码有什么问题?索引越界
我正在尝试读取包含 nmea 字符串的文本文件!但我得到了
??? Attempted to access y(1); index out of bounds because numel(Longitude)=0.
Error in ==> filter at 16
Loc(:,i)=coordinates(x(i),y(i))';
filter.m,
clear all
A=textread('xxx\x.txt','%s','headerlines',1);
for i=1:30;
n=2*i-1;
A(i)=A(n);
end
b=A(1:30,:);
c=char(b);
x=c(:,17:24);
y=c(:,28:36);
我不明白为什么它是错误的?!!
I'm trying to read in a text file that contains nmea strings! But I get
??? Attempted to access y(1); index out of bounds because numel(Longitude)=0.
Error in ==> filter at 16
Loc(:,i)=coordinates(x(i),y(i))';
filter.m
clear all
A=textread('xxx\x.txt','%s','headerlines',1);
for i=1:30;
n=2*i-1;
A(i)=A(n);
end
b=A(1:30,:);
c=char(b);
x=c(:,17:24);
y=c(:,28:36);
I can't figure out why it is wrong?!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您剪掉了字符串的错误部分,并以
,N,
开头部分结束(并且也没有小数)。我相信你想要You cut out the wrong part of the string and end up with the
,N,
part in the beginning (and also no decimals). I believe you want我的猜测是
c(:,28:36)
是空的,这意味着A
也可能是空的。My guess is that
c(:,28:36)
is empty which impliesA
might be empty too.A
为空。使用 TEXTSCAN 代替:A
is empty. Use TEXTSCAN instead: