Assignment has more non-singleton rhs dimensions than non-singleton subscripts

1 回表示 (過去 30 日間)
Manil Athapattu
Manil Athapattu 2017 年 6 月 23 日
コメント済み: Walter Roberson 2017 年 6 月 23 日
hi I keep getting the error which i mentioned in the question.This is a part of the code in which there is an error, if someone could help me out that would be great. G is a constant defined as 1.2, p_0 is a constant defined as 125000, c is a counter which goes from 1 to 10, n is your max count which is 10.rho is another constant defined as 1.023 and p_0 is defined as 1.225.
pressure = zeros(n,1);
pressure(c,:) = p_0;
p = (rho/rho_0).^G .*p_0;
pressure(c,:) = p;
end
  1 件のコメント
Walter Roberson
Walter Roberson 2017 年 6 月 23 日
You do not tell us anything about rho_0 .
When the problem occurs, what does size(p) show ?

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2017 年 6 月 23 日
G = 1.2 ;
p_0 = 125000 ;c = 1:10 ;
n = 10 ;
rho = 1.023 ;
rho_0 = 1.225 ;
p = (rho/rho_0).^G .*p_0;
pressure(c,:) = p;

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by