MATLAB Answers

dimension mismatch??! i cant see how this can be a dimension mismatch?

1 view (last 30 days)
Adam on 19 Oct 2011
A.textdata(:,3) holds a large set of dates
I am trying to do this:
for i=1:size(A.textdata)
Dates(i,1) = datenum(A.textdata(i,3),'dd-mm-yyyy HH:MM:SS');
Dates2(i,1) = datestr(Dates(i,1),'dd-mm-yyyy ')
but i am getting thins error:
> ??? Subscripted assignment dimension mismatch.
Error in ==> Load at 12 Dates2(i,1) = datestr(Dates(i,1),'dd-mm-yyyy ')
Why is that? i cant see how there can be any dimension mismatches??


Sign in to comment.

Accepted Answer

Daniel Shub
Daniel Shub on 19 Oct 2011
The problem is that
is a scalar, but
datestr(Dates(i,1),'dd-mm-yyyy ')
returns a string with length 10.
Dates2(i,:) = datestr(Dates(i,1),'dd-mm-yyyy ');
should work.


Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by