Is there a way to make a str(1) add one in a while loop so it would give str(2) instead?
2 ビュー (過去 30 日間)
古いコメントを表示
Jonathan Weaver
2017 年 11 月 24 日
回答済み: Walter Roberson
2017 年 11 月 24 日
So I am working on a project for my matlab class. I am making a morse code encoder and decoder. I was going to make it so that I would have them enter the code it, and it would use a loop to split each character up. Then it would run each one through a while loop till the character found the right translation of dots and dashes. My question is there a way when splitting them the code up that I could make code(1) add one so like code(1+1) each time it is run in the initial loop. I am planning on having an isempty to end the loop once there are no more characters.
0 件のコメント
採用された回答
Walter Roberson
2017 年 11 月 24 日
counter = 0;
...
for ...
counter = counter + 1;
... code(counter) ...
end
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!