related to the fprintf

3 次查看(过去 30 天)
PA
PA 2022-7-5
评论: PA 2022-7-5
SCRW;NAME;SCRW_1
SCRW;NAME;SCRW_2
SCRW;NAME;SCRW_3
SCRW;NAME;SCRW_4
i need a text file exactly this way so how can i write the code with. it should execute automatically with the number of shoes

回答(1 个)

Walter Roberson
Walter Roberson 2022-7-5
number_of_shoes = 4;
for shoe_number = 1 : number_of_shoes
filename = sprintf('SCRW;NAME;SCRW_%d', shoe_number)
end
filename = 'SCRW;NAME;SCRW_1'
filename = 'SCRW;NAME;SCRW_2'
filename = 'SCRW;NAME;SCRW_3'
filename = 'SCRW;NAME;SCRW_4'

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by