matlab preallocation problem in for loop
1 次查看(过去 30 天)
显示 更早的评论
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
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
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!