find a specific file
이전 댓글 표시
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
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
2013년 10월 8일
채택된 답변
추가 답변 (1개)
Image Analyst
2013년 10월 8일
You can use sprintf() to create filenames based on variables:
filename = sprintf('Stresses_AxSym_UP_%d_%d.txt', integer1, integer2);
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!