i have a mistake named Subscripted assignment dimension mismatch.
4 ビュー (過去 30 日間)
古いコメントを表示
krillbest=zeros(3,16,q1-1,cn);
for i=1:q1-1
krillbest(:,:,i,1)=bestkrill(:,:,i);
end
please return me immmediately, i have to solve this problem immediately.Thanks for everything
3 件のコメント
回答 (3 件)
Walter Roberson
2015 年 8 月 8 日
krillbest=zeros(3,16,q1-1,cn);
krillbest(:,:,:,1) = bestkrill;
If you want bestkrill copied to each of the cn layers then use
krillbest = repmat(bestkrill, 1, 1, 1, cn);
0 件のコメント
Walter Roberson
2015 年 8 月 8 日
Illustration:
q1 = 11;
cn = 5;
bestkrill = rand(3,16,q1-1); %put any data you want here.
krillbest=zeros(3,16,q1-1,cn);
for i=1:q1-1
krillbest(:,:,i,1)=bestkrill(:,:,i);
end
The code from krillbest onwards was copied exactly from your posting, and it works without problem, provided that the size() of the first two dimensions of bestkrill are the same as 3, 16, and that the size of the third dimension of bestkrill is at least as large as q1-1 .
It seems likely to me that in your code, bestkrill is not the size you expect. You need to look at size(bestkrill) and be sure that really does start 3, 16.
At the command line, give the command
dbstop if error
and then run your initial code. When it stops with the error, examine the size() of each of the variables.
参考
カテゴリ
Help Center および File Exchange で Debugging and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!