How can I loop this to make it go automatically?

2 vues (au cours des 30 derniers jours)
Lucas
Lucas le 5 Jan 2024
Commenté : Dyuman Joshi le 6 Jan 2024
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 commentaires
Steven Lord
Steven Lord le 5 Jan 2024
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 le 6 Jan 2024
The question, imo, should be - Why do you want to do this? What is the objective?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by