using the int i as output name

1 回表示 (過去 30 日間)
Sobel Captain
Sobel Captain 2015 年 11 月 19 日
コメント済み: Stephen23 2024 年 8 月 29 日
Hi,everyone.I would like to ask a question about using the int i as output name , I hope someone could help me . such as for i=1:30; I have a function I would like to put 30 different input using for loop . just like input (i)=xxx ->my program->output (i)=xxxx I would like to have 30 input(some audio file 1.wav 2.wav 3.wav ............) and 30 output , output 1 output 2 output 3, I have tried output(int i) that's not works , also int2str(i) is not working too. could any one tell me how to do that , thanks a lot .

回答 (1 件)

Prateekshya
Prateekshya 2024 年 8 月 29 日
Hello Sobel,
For this purpose, you can use sprintf() function. This function will use an integer to generate the name of the file. Here is an example of the same:
sprintf('%d.wav', i);
This line of code can be wrapped inside a for loop to generate multiple such names depending on i.
For more information on sprintf() please follow this link: https://www.mathworks.com/help/matlab/ref/sprintf.html
I hope this helps!

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by