Error : Subscripted assignment dimension mismatch.
1 回表示 (過去 30 日間)
古いコメントを表示
When I ran the following code to the line 'M_ORE(i,:) = table2array(M_ROCK(i,:));', the error 'subscripted assignment dimension mismatch' appeared.
This is the screenshot of part dataset, I want to transfer values from M_ROCK into M_ORE1 and M_ORE2 according to the 'r1_mill_tonnage' and 'r2_mill_tonnage' strings.
Therefore, how to slove the error 'sunscripted assignment dimension mismatch' and get the correct objective matrix?
Many thanks in advance for your help!

elseif rock_index == 2
%%
M_ROCK = rock;
M_ROCK = array2table(M_ROCK,'VariableNames',G_Value.Properties.VariableNames);
%
num=input('Please enter the number of rock types:');
%
M_WASTE = zeros(R1,C1);
M_ORE = zeros(R1,C1,num);
STR = cell(1,num);
for i = 1 : R1
for j = 1 : num
STR{j} = sprintf('r%d_mill_tonnage',j);
if table2array(M_ROCK(i,STR{j})) > 0
M_ORE(i,:) = table2array(M_ROCK(i,:));
else
M_WASTE(i,:) = table2array(M_ROCK(i,:));
end
end
end
4 件のコメント
Walter Roberson
2021 年 6 月 2 日
I would claim that R1 is not a current row index into M_ROCK, and is instead exactly 814723 .
You could disprove this claim by posting the code that sets R1 and by showing the size() of M_ROCK and the value of R1 at the time that the error occurs.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Discrete Data Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!