Storing data from while loop into an array
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I'm still new to MatLab and have had some success writing code for my work, but need to store the data from a 'while' loop to an array that can then be exported to an Excel file. The current code just displays each value of PbC with the corresponding 'f'. I'd like to put it to export with two columns, with one column being 'f' and the other being the output of the variable PbC.
ratioA=input('Enter isotope ratio 1 of magma A: ');
PbA=input('Enter elemental ppm 1 of magma A: ');
%Magma B
ratioB=input('Enter isotope ratio 1 of Magma B: ');
PbB=input('Enter elemental ppm 1 of magma B ');
f=0;
while f<=0.09
f=f+0.01;
PbC= ((f*PbA*ratioA)+((1-f)*ratioB*PbB))/((f*PbA)+((1-f)*PbB));
Mix=[f; PbC];
end
% Mixing step of .1-1
while f<=0.99
f=f+0.1;
PbC= ((f*PbA*ratioA)+((1-f)*ratioB*PbB))/((f*PbA)+((1-f)*PbB));
Mix=[f; PbC];
end
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Data Import from MATLAB in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!