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

New to MATLAB?

saving the data in excel

Asked by phani

phani (view profile)

on 14 Jun 2012

hi all, i am having a 50 files in which every time i want to read a single file and perform some operations on the data and i get an output of 13x1 matrix i want to save this data in an excel file in sheet 1( i can use xlswrite options), when i am reading the second file it has to store output in sheet 2 automatilcally how can i do this?. i want to run this in a for loop. how to save the each output in different sheet. someone please help me. thanks in advacne.

0 Comments

phani

phani (view profile)

Products

No products are associated with this question.

1 Answer

Answer by Ilham Hardy

Ilham Hardy (view profile)

on 14 Jun 2012
Accepted answer

Hi,

you can define sheet name on the xlswrite function.

xlswrite(filename, M, sheet)

I can imagine that you can put the integer as (a part of) sheet name

add

warning off MATLAB:xlswrite:AddSheet

to supress addsheet warning

HTH,

IH

1 Comment

phani

phani (view profile)

on 14 Jun 2012

hi, thanks for your reply, i don't want to add the sheet number manually every time, i want it to happen in the loop . i am providing the code below

for i=1:1:24
fname='figure';
ext='.png';
fnamer=sprintf('%s %d%s',fname,i,ext);
I=imread(fnamer);
a=rgb2gray(I);
end
% i want to perform some mathematical operations on matrix 'a' , which gives me an output of 13x1 matrix and i want to save this in sheet1 in a excel file. when i value increments to 2 again it will give me a 13x1 matrix as output and i want to save this in sheet2 of the same excel file and as the loop progress i want it to save in the appending sheets.
thank you .

Ilham Hardy

Ilham Hardy (view profile)

Contact us