Storing data from while loop into an array

1 次查看(过去 30 天)
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 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by