0
pic1 = double (Pic1);
pic2 = double(Pic2);
pic3 = double(Pic3);
pic4 = double(Pic4);

ILB = 1;
B = pic1./ILB;

ILC = 0.2;
VC(1:1024,1:1024)= 0.581695;
VT = 0.025;
C = (pic2 - B*ILC)./(exp(VC./VT))

IL = 1;
V1 = VT*log((pic3 - B*IL)./(C));
V2 = VT*log((pic4 - B*IL)./(C));

Vapp1(1:1024,1:1024)=0.616185;
Vapp2(1:1024,1:1024)=0.575044;

jp = input('Please enter the jp value ranging between 36 to 40 mA/cm^2: ');
if jp >0

R =(((Vapp2-V2).*exp(V1./VT))-((Vapp1-V1).*exp(V2./VT)))./(jp.*(exp(V2./VT)-exp(V1./VT)))
imagesc(R)

j0 = ((Vapp2-V2-Vapp1+V1).*(jp))./(exp(V1./VT).*(Vapp1-V2)-exp(V2./VT).*(Vapp1-V1));
figure;
imagesc(j0)

end

I want to export the R and J0 data values shown in workspace respectively into an excel file or txt. file. What is the coding to do that?

0

1 Answer 1

1

As mentioned in http://www.mathworks.com/help/matlab/ref/csvwrite.html?requestedDomain=www.mathworks.com you can use csvwrite(filename,M) to export variables to a csv file. Then you just have to import the file in Excel.

Try:

csvwrite('R_var.csv', R);
csvwrite('j0_var.csv', j0);
Sign up to request clarification or add additional context in comments.

2 Comments

A .csv file is not an excel file, even though excel can still read theses. Worth trying with xlswrite() as well.
Due to @shoba asking for an excel file or txt I chose a format which would work both on Excel and notepad(s). But the xlswrite() also does the job :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.