How to make a 'case' go over each element in a vector ?

2 ビュー (過去 30 日間)
Julia Dombroski
Julia Dombroski 2023 年 2 月 4 日
コメント済み: Image Analyst 2023 年 2 月 4 日
I want to modify case 'f' in my function to have it move over each element in a vector.
For example, in the vector TIMES I have elements that are times cues. What I want is, everytime I press f, I get the object tcues updaded to be one element in TIMES. tcues will be used to plot an interactive spectrogram.
TIMES=[590, 1090, 2090];
so every time I press 'f' want to have
tcue = TIMES(1)+floor(NS)-0.5 ;
then
tcue = TIMES(2)+floor(NS)-0.5 ;
and so forth...
all I have now is
case 'f'
tcue = TIMES()+floor(NS)-0.5 ;
done = 1 ;
Any insigts are appreciated.
  1 件のコメント
Image Analyst
Image Analyst 2023 年 2 月 4 日
No idea what yoiu want. But it looks like maybe you want a while loop that loops as long as someone hits a key. And we don't know what the switch line looks like because you forgot to include it. Is it testing the character value of the key they typed?

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

回答 (1 件)

David Hill
David Hill 2023 年 2 月 4 日
tcue = TIMES+floor(NS)-0.5;

カテゴリ

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