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!