フィルターのクリア

Storing data from while loop into an array

1 回表示 (過去 30 日間)
c_def
c_def 2016 年 6 月 7 日
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 Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by