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

Thread Subject:
input argument change in for loop matlab

Subject: input argument change in for loop matlab

From: Anthony

Date: 14 Oct, 2010 11:30:09

Message: 1 of 2

I have created a for loop to process data, as I have four double sheets labelled A,B,C and D I have therefore copied the for four times to process each of the sheets, to give Ap,Bp,Cp and Dp, where p means processed.
I want to only have one for loop that will select each of the specified worksheets, process them and give the output in a separate sheet, Ap,Bp,Cp and Dp
eg I have tried this sort of thing filename etc but to no avail!

for sheet =A,B etc
prosess data
A,B()
End

Subject: input argument change in for loop matlab

From: Sean

Date: 14 Oct, 2010 14:16:03

Message: 2 of 2

"Anthony " <anthony.crimin@strath.ac.uk> wrote in message <i96pk1$8e3$1@fred.mathworks.com>...
> I have created a for loop to process data, as I have four double sheets labelled A,B,C and D I have therefore copied the for four times to process each of the sheets, to give Ap,Bp,Cp and Dp, where p means processed.
> I want to only have one for loop that will select each of the specified worksheets, process them and give the output in a separate sheet, Ap,Bp,Cp and Dp
> eg I have tried this sort of thing filename etc but to no avail!
>
> for sheet =A,B etc
> prosess data
> A,B()
> End

Cell_of_stuff = {Ap,Bp,Cp,Dp}; %combine all you processed sheets in a cell
for ii = 1:4
     Current_sheet = Cell_of_stuff{ii}; %Extract that sheet.
     %Do your other stuff.
end

%You could also have done the Ap, Bp... calculations in a similar way with one loop, then you wouldn't need to make this cell manually.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us