I'm getting a matrix subscript index error
古いコメントを表示
The error is:
Subscript indices must either be real positive integers or logicals.
I'm referencing each matrix using the following:
time_stamp = [time_stamp; datestr(now, 31)];
fprintf(fid, %s ... ,time_stamp(end, 1:end), ...);
This is in a while loop and time_stamp grows each cycle through by one string. Why am I getting this error if I'm using 'end' to reference the matrix?
5 件のコメント
Azzi Abdelmalek
2013 年 10 月 24 日
How are we supposed to know ? please post your code with the line causing the error
Brian
2013 年 10 月 25 日
What does DBSTOP tell you? In particular, when code execution stops at the K>> prompt and you execute
K>> time_stamp(end, 1:end)
what is the result?
Brian
2013 年 10 月 25 日
I'm not sure you answered my question. What specifically is the output (include error messages please) when you execute this expression in isolation
K>> time_stamp(end, 1:end)
回答 (2 件)
Walter Roberson
2013 年 10 月 25 日
0 投票
You assigned a value to a variable named "datestr" and then tried to use datestr() as a function call.
1 件のコメント
Azzi Abdelmalek
2013 年 10 月 25 日
Brian commented
datestr() is a built-in function already created in Matlab. I have not assigned anything to it.
Kelly Kearney
2013 年 10 月 25 日
Perhaps you accidentally made end the name of a variable? At that line, what does
which end
return?
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!