Saving output from function in different categories
Show older comments
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');
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!