How can I loop this to make it go automatically?

2 ビュー (過去 30 日間)
Lucas
Lucas 2024 年 1 月 5 日
コメント済み: Dyuman Joshi 2024 年 1 月 6 日
I can not find how to do this automatically.. Can Anybody help me with this?
StrideDurationlg_9 = (EventData(1:4).StrideDuration);
StrideDurationtm_9 = (EventData(5).StrideDuration);
StrideDurationlg_10 = (EventData(6:10).StrideDuration);
StrideDurationtm_10 = (EventData(11).StrideDuration);
StrideDurationlg_11 = (EventData(12:18).StrideDuration);
StrideDurationtm_11 = (EventData(19).StrideDuration);
StrideDurationlg_12 = (EventData(20:24).StrideDuration);
StrideDurationtm_12 = (EventData(25).StrideDuration);
StrideDurationlg_13 = (EventData(26:30).StrideDuration);
StrideDurationtm_13 = (EventData(31).StrideDuration);
StrideDurationlg_14 = (EventData(32:36).StrideDuration);
StrideDurationtm_14 = (EventData(37).StrideDuration);
StrideDurationlg_16 = (EventData(38:43).StrideDuration);
StrideDurationtm_16 = (EventData(44).StrideDuration);
  3 件のコメント
Steven Lord
Steven Lord 2024 年 1 月 5 日
Can you dynamically create variables with numbered names like StrideDurationlg_9, StrideDurationtm_9, StrideDurationlg_10, etc.? Yes.
Should you do this? The general consensus is no. That Answers post explains why this is generally discouraged and offers several alternative approaches.
But I agree with @Torsten that there is no pattern I can see in how much data gets put into each variable.
Dyuman Joshi
Dyuman Joshi 2024 年 1 月 6 日
The question, imo, should be - Why do you want to do this? What is the objective?

サインインしてコメントする。

回答 (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