rename single .txt file with changing seed number
4 ビュー (過去 30 日間)
I've created a GUI with App Designer. It's basic, four drop down menus with descriptors, and a single button that renames a .txt file
The file i'm trying to rename is spit out by a data aquisition software that names the file with a prefix and a seed number. For example:
"NewTest00001.txt", then the next save spits out "NewTest00002.txt", ecetera.
The code i've written within the ButtonPushed function is as follows:
Which works when the file name matches, the problem is that the seed changes after every save. I've tried changing the code to
But that creates a new folder within the "Renamed" folder due to the * which interprets it as a folder instead of a text file.
There's got to be a simple solution i'm unaware of where the code reads in the text file like "<NewTest><LiterallyAnyNumber>.txt" and renames it.
Essentially I run test, save test as "NewTest#####.txt", Press the rename button in my GUI, repeat.
Chris 2022 年 9 月 22 日
編集済み: Chris 2022 年 9 月 22 日
Do you know the seed?
testSeed = 454;
NewTest = strcat('C:\Users\PC\Desktop\TestData', num2str(testSeed), '.txt')
If you want the same number of digits in the seed each time:
testStr = sprintf('%05d',testSeed);
NewerTest = strcat('C:\Users\PC\Desktop\TestData', testStr, '.txt')