Saving transformed data into a new array

I have a set of data (x,y) (or (z,PDI) below) and need to apply an equation to the y-data to create a transformed set of (say y') and then save as a new set (x,y'). I have it all figured out up until the saving.. I show the data (y' = dose in the code below)but I'm not sure how to save it as a new array (z,dose)
function Burns(i,z,PDI)
% z: depth
% PDI: Percent Depth Ionization
% i: I_50 - Depth at 50 % Ionization Value
%data: Name of original data array (import fr Excel/OP, depth vs ion.)
a = 1.0752;
b = -0.50867;
c = 0.088670;
d = -0.08402;
e = -0.42806;
f = 0.064627;
g = 0.003085;
h = -0.12460;
%calculate R50 = r
r = 1.029*i - 0.063;
%apply Burns equation with correction for z in mm -> cm
burns = (a + b*(log(r)) + c*(log(r)^2) + d*((z/10)/r)) ./ (1 + e*(log(r)) + f*(log(r)^2) + g*(log(r)^3) + h*((z/10)/r));
display(burns);
%apply correction to Ionization to turn to Dose
dose = burns.*PDI;
display(dose);
%display/save new variable array dose vs depth

 采纳的回答

got it - using :
A=[z DoseCorrected];
save('DepthDose2.mat','A');
thanks for your help!

更多回答(1 个)

Perhaps:
save('FileName.mat', 'dose', 'depth')
?? What does "saving" exactly mean in your problem?

2 个评论

I wasn't sure if that was the right word to use I don't know how to rephrase.. um I need to go from (z,PDI) to (z,dose) using the equation above that basically multiplies all of the PDI numbers by a certain factor, and then be able to work with (plot, compare, etc) the new (z,dose) numbers instead of the (z,PDI) numbers
The way that saves now, if I double click on 'FileName' it opens two separate columns, one is z and one is dose, I need those to both be in the same array as an (x,y) type row/column relationship for graphing

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by