Monday 15 September 2014

matlab - Inner matrix dimensions must agree error -


I have a piece of code in which I save the array values ​​in the .txt file and then retrieve me in another function To make those values ​​from .txt in an array ... the code looks something like this ...

  fid = fopen ('c: \\ coeffs2.txt', 'wt' ); Fprintf (fid, '% f \ n', descr2); Fclose (fid);   

And in another file, I get it recovered.

  fid = fopen ('c: \\ coeffs2.txt'); Des2 = []; Des2 = fscanf (feeds, '% f \ n'); Fclose (fid);   

I get an error because the internal matrix dimension must agree ... please help!

Are you sure these lines are causing the error? What exactly is the line where the error occurs? Generally this happens if you had matrix multiplication ( * ) (for example), when you factor with element of element with no non-square (. * ) matrix ...

You save ('c: \\ coeffs2.mat', 'descr2'); As the alternative (more efficient) way to store / retrieve the metrics (and more efficient), and make sure that you do not change the dimensions, use and loads ('c: \\' coeffs2).

Did you try to see that the size (descr2) gives before saving and before retrieval? Maybe you just have a resize ... is required

No comments:

Post a Comment