Solving "Subscripted assignment dimension mismatch" error message.

1 view (last 30 days)
Dear all,
In NN toolbox matlab, I want to use Input data which is a 165238 × 9 matrix, means 9 columns and 165238 rows of data as Input. Matlab shows this error "Subscripted assignment dimension mismatch" when I insert the "imaginary" variable at the 8 th colum.
Here is the code I used:
-----------------------------
EX_355 = xlsread('filename.xlsx','B2:B165238');
EX_532 = xlsread('filename.xlsx','C2:C165238');
BA_355 = xlsread('filename.xlsx','D2:D165238');
BA_532 = xlsread('filename.xlsx','E2:E165238');
BA_1064 = xlsread('filename.xlsx','F2:F165238');
Reff = xlsread('filename.xlsx','G2:G165238');
nm = xlsread('filename.xlsx','H2:H165238');
real = xlsread('filename.xlsx','I2:I165238');
imaginary = xlsread('filename.xlsx','J2:J165238');
mode_width = xlsread('filename.xlsx','K2:K165238');
Input(1,:) = EX_355;
Input(2,:) = EX_532;
Input(3,:) = BA_355;
Input(4,:) = BA_532;
Input(5,:) = BA_1064;
Target(1,:) = Reff;
Input(6,:) = nm;
Input(7,:) = real;
Input(8,:) = imaginary;
Input(9,:) = mode_width;
--------------------------------------------------------------------
after reading Input(8,:) = imaginary; matlab shows the error message.
I have a snapshot of the data, but do not know how to attach it with this Question here.
How to solve this problem? I could not solve it so far by taking matlab error message solutions help. I hope someone will help me in this regard. Thanks
  4 Comments
Jonathan Epperl
Jonathan Epperl on 31 Oct 2012
The data types aren't the issue, the dimensions of your variables are. So why don't you just do a clear all, run the lines of code up to and including mode_width = xlsread('filename.xlsx','K2:K165238');, then run
whos
and post the output here?
Jan
Jan on 31 Oct 2012
@Jonathan: I do not see any reason to remove all loaded function files from the memory and delete all persistent data as well as globals. The re-initialization an the new parsing of all used functions waste a lot of time. Therefore I strongly recommend not not use clear all but clear the concerned variables explicitly, or at least only variables: clear variables.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!