フィルターのクリア

Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-14.

3 ビュー (過去 30 日間)
My code is coming up with an error saying "Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-14." on the line highlighted by the asterix but the workspace shows that the variables P9 and z are both 1 x 14. the beginning of the if loop works, produces a 1 x 14 matrix with the first 2 cells populated by Pa and the remainder with zeros due to the error.
for i=1:14
if x(1,i) < Pcrit_c
P9(1,i) = Pa;
T9s = To5.*(P9./Po5).^((gamma_g-1)/gamma_g);
T9 = eta_n*(T9s-To5)+To5;
V9 = sqrt(2*Cp_g*1000*(To5-T9));
else
**** P9(1,i) = z;**** < this line
T9s = To5*(P9/Po5)^((gamma_g-1)/gamma_g);
T9 = eta_n*(T9s-To5)+To5;
V9 = sqrt(gamma_g*R*1000*T9);
end
end

回答 (1 件)

Sreelakshmi S.B
Sreelakshmi S.B 2019 年 3 月 8 日
P9 might be of size 1x14 but you're assigning z (of size 1x14) to P9(1,i) which is of size 1

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by