matlab preallocation problem in for loop

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 Comment

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.

Sign in to comment.

 Accepted Answer

fluid_HX = cell(length(t),1);
for j=1:length(t)
fluid_HX{j}=refprop(v(j),T_in(j),r410a);
end

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Asked:

on 23 Apr 2019

Commented:

on 23 Apr 2019

Community Treasure Hunt

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

Start Hunting!