## write data to excel sheet column

Asked by Lalit Patil

### Lalit Patil (view profile)

on 3 Oct 2012
Accepted Answer by Azzi Abdelmalek

### Azzi Abdelmalek (view profile)

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..

## Products

No products are associated with this question.

### Azzi Abdelmalek (view profile)

Answer by Azzi Abdelmalek

### Azzi Abdelmalek (view profile)

on 3 Oct 2012
Edited by Azzi Abdelmalek

### Azzi Abdelmalek (view profile)

on 3 Oct 2012

```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')
```

Lalit Patil

### Lalit Patil (view profile)

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

### Azzi Abdelmalek (view profile)

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

### Walter Roberson (view profile)

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.

#### Join the 15-year community celebration.

Play games and win prizes!

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