find a specific file
Ältere Kommentare anzeigen
Hello,
I have different data on a similar numerical model stored in text with similar but different names.
What I want to know is if it possible to find a file base on its name Basically I open these files in my code:
Stresses-UP-7_5-22_5-0MPa.txt
Stresses-UP-8-22-14MPa.txt
Within my code, I would like to find a specific value stored in another text file names:
Stresses_AxSym_UP_7-5_22-5.txt
Stresses_AxSym_UP_8_22.txt
both text files correspond to the same models having dimensions: 1) 7.5 and 22.5; and 2) 8 and 22.
the text file names are different, in one the names are separated by underscore and the other by the minus sign. Would it be possible to code something to find the Stress_AxSym text file based on the information of Stress_UP text file?
thank you
2 Kommentare
So you know the first file name and you want to generate the corresponding second file name based on the first? Or are you just asking how to generate all file names based on 7.5, 22.5, 8, 22? In any case, what happens to the 'OMPa' and '14MPa' parts of the first names? Are they discarded?
Nicolas
am 8 Okt. 2013
Akzeptierte Antwort
Weitere Antworten (1)
Image Analyst
am 8 Okt. 2013
You can use sprintf() to create filenames based on variables:
filename = sprintf('Stresses_AxSym_UP_%d_%d.txt', integer1, integer2);
Kategorien
Mehr zu Characters and Strings finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!