Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

write data to excel sheet column

Asked by Lalit Patil on 3 Oct 2012

Hi, I have certain data. I want to write this data into excel sheet columns into incremental order.. like first data will be written in 'A' column, second data to 'B' column.. third data to 'C' column.. and so on.. so how can i do this... please suggest code or method..

0 Comments

Lalit Patil

Products

No products are associated with this question.

1 Answer

Answer by Azzi Abdelmalek on 3 Oct 2012
Edited by Azzi Abdelmalek on 3 Oct 2012
Accepted answer
A = {1,2,3,4}; B = {1,3,4}; C = {2,5,3,7,6} 
n=max([length(A),length(B),length(C)])
R=cell(3,5) 
R(1,1:length(A))=A
R(2,1:length(B))=B
R(3,1:length(C))=C
xlswrite('filename.xls',R')

3 Comments

Lalit Patil on 3 Oct 2012

Thank you sir... This is the thing what i want... But in future i also need the same thing for upto more than z columns... so is there any code or logic to use 'for' loop to make code short...

Azzi Abdelmalek on 3 Oct 2012

I think there is a way, just ask your question. If it's not me who can answer, someone else can do.

Walter Roberson on 4 Oct 2012

Whether you can create a loop to make the code short depends on the representation of the data you want to store.

Azzi Abdelmalek

Contact us