Solving "Subscripted assignment dimension mismatch" error message.

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 个评论

  1. Commonly, 9 x 16000 means 9 rows, 16000 columns, not vice versa
  2. Use the code-environment to insert code -- insert it in a new paragraph with two leading spaces.
  3. If, after assigning mode_width = xlsread('filename.xlsx','K2:K165238'); you enter the command whos, what are the dimensions of all your variables, and most importantly are they the same for all variables that you stick into a row of Input? My guess is not, in particular imaginary will be different, and that's why you're getting the error. Probably empty or invalidly filled cells in your spreadsheet are to blame.
Thank you Jonathan, i have corrected the Question.
Previously i used the same data ('imaginary' variable) along with other variables, but Matlab did not show any problem.
The data types are not same in all variables. for example some data from 'imaginary' variable is as follows:
0.00E+00
1.00E-03
1.00E-03
1.00E-04
1.00E-05
1.00E-08
2.50E-03
5.00E-03
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?
@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.

请先登录,再进行评论。

回答(0 个)

类别

标签

提问:

2012-10-30

Community Treasure Hunt

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

Start Hunting!

Translated by