フィルターのクリア

matlab preallocation problem in for loop

1 回表示 (過去 30 日間)
WANYI ZHANG
WANYI ZHANG 2019 年 4 月 23 日
コメント済み: WANYI ZHANG 2019 年 4 月 23 日
Hi
Can anyone tell me how can I fix this preallocation problem in matlab.
Thanks!
fluid_HX = struct;
for j=1:length(t)
fluid_HX{j}=refprop(v(j),T_in(j),r410a);
end
  1 件のコメント
KSSV
KSSV 2019 年 4 月 23 日
YOu have initialized fluid_HX as a structure. Read about structures...it needs some field value.
If you want a cell initialize it as a cell.

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

採用された回答

KSSV
KSSV 2019 年 4 月 23 日
fluid_HX = cell(length(t),1);
for j=1:length(t)
fluid_HX{j}=refprop(v(j),T_in(j),r410a);
end
  1 件のコメント
WANYI ZHANG
WANYI ZHANG 2019 年 4 月 23 日
Thanks a lot!
That worked

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by