フィルターのクリア

Simple For Loop Problem

2 ビュー (過去 30 日間)
Sarah
Sarah 2011 年 10 月 15 日
Hey guysss,
I have a relatively simple problem related to For Loops. Let us say I have this bit of code:
[TPV1.Sig, TPV1.Str] = xlsread('CHAMBER TEST TEMP 4 5 6.xlsx',3);
TPV1.Num = datenum(TPV1.Str);
TPV1.Vec = datevec(TPV1.Num);
The thing is, I have about 10-15 signals that I have to process. Rather than spend a lot of time copying/pasting the code 15 times, I want to write a simple for loop that runs this function over and over again, but stores into different variables. For example:
1st Iteration: Returns: TPV1.Sig, TPV1.Str, TPV1.Num, TPV1.Vec
2nd Iteration Returns: TPV2.Sig, TPV2.Str, TPV2.Num, TPV2.Vec
etc etc
I was thinking setting up the for loop to be like:
for N = 1:15,
[TPV*N*.Sig, TPV*N*.Str] = xlsread('CHAMBER TEST TEMP 4 5 6.xlsx',3);
TPV*N*.Num = datenum(TPV*N*.Str);
TPV*N*.Vec = datevec(TPV*N*.Num);
The following code is obviously wrong...and I am not sure if I can successfully do this. Any thoughts, anyone??

採用された回答

the cyclist
the cyclist 2011 年 10 月 15 日
The second example in the accepted answer to this question
(cell arrays) should allow you to do what you want.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by