In an assignment A(I) = B, the number of elements in B and
1 view (last 30 days)
Show older comments
Hello,
I am acquiring some data from a series of log files. when i use one specific log file everything works. When i choose any other log, i get this error :
In an assignment A(I) = B, the number of elements in B and I must be the same. Error in ==> memory_analysis2 at 22 Reading(i) = fscanf(fid, '%d', 1);
It is really strange because with another log file the same code works just fine. anyone has any ideas or same experience on this???? Thank you in advance.
0 Comments
Accepted Answer
Jan
on 15 Aug 2011
The shown lines fails, if FSCANF cannot read a value, e.g. if the end-of-file is reached or if the available data do not match the %d format. Better include a test:
temp = fscanf(fid, '%d', 1);
if length(temp) == 1
Reading(i) = temp;
else
error('cannot get value');
end
More Answers (0)
See Also
Categories
Find more on Data Import and Export in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!