Saving output from function in different categories
이전 댓글 표시
I have vehicles BEV, the variable can have the value BEVR, BEVU or BEVA.
I have households Household, the variable can have the value House, Apartment and [Apartment House]
The inner loop contains functions for how many households are considered.
My question is how I best can save the variables GUD and GUDID?
for i=1:0
if i==1
BEV=BEVA;
Household=Apartment
end
if i==2
BEV=BEVR;
Household=House;
end
%More if statements...
if i==9
BEV=BEVU
Househol=[Apartment House];
end
for z=1:3
if z==1
[GUD,GUDID]=H1(ID,HHPerson,nBEV,BEV,x,Hcombos,Household,sample);
end
if z==2
[GUD,GUDID]=H2(ID,HHPerson,nBEV,BEV,x,Hcombos,Household,sample);%run('H2')
end
if z==3
[GUD,GUDID]=H3(ID,HHPerson,nBEV,BEV,x,Hcombos,Household,sample);
end
end
end
I have so far tried this, but I need a way to save everything. I guess I can use sprintf within the for loop multiple times, but is there another thats faster?
save(sprintf('BEVU/Apu/AUG%d',z), 'GUD');
save(sprintf('BEVU/Apu/AUI%d',z), 'I2');
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 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!