How do I access reference text file? Low Level I/O

2 次查看(过去 30 天)
Hello, I am trying to do this "The reference filenames will always be formatted as ‘<input1>_#.txt’. For example, if the first input of the function were ‘hpLastPage’ and the current cipher line were 3-23-8-4, you would be looking in the file called ‘hpLastPage_3.txt’."
fh2 = fopen('cipher_1.txt')
line2 = fgetl(fh2);
Line2 = 1-21-9-1;
[a line2] = strtok(line2, '-');
a = 1
line2 = -21-9-1
[fileName, ~] = strtok('hpLastPage')
tiger = [fileName, '_kat.txt'];
This is what I did and for tiger I got
tiger = 'hpLastPage_a.txt'
How do I get hpLastPage_1.txt rather than hpLastPage_a.txt.
Thank you.

采纳的回答

per isakson
per isakson 2015-2-24
matFileName = sprintf('mat%d.mat', k);
  3 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by