- Commonly, 9 x 16000 means 9 rows, 16000 columns, not vice versa
- Use the code-environment to insert code -- insert it in a new paragraph with two leading spaces.
- 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.
Solving "Subscripted assignment dimension mismatch" error message.
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Jonathan Epperl
2012 年 10 月 31 日
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
2012 年 10 月 31 日
@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 件)
参考
カテゴリ
Help Center および File Exchange で Large Files and Big Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!