How do I run a command only if certain characters exist in a string
古いコメントを表示
Hi
I'm trying to run a command that lets me open a file and then will run a process on that imported file depending on characters in the file name.
Say for example I open a file form a folder and then save that filepath as a string. I then want to run a process on it depending on the name of the file path.
The file names are TestMax, TestMin,TestMean
for i = int8(1:nUPSS)
[filename1, dir] = uigetfile('C:\Outputs','Select Trial');
load([dir filename1])
Therefore my trial name becomes either
filename1 = 'TrialMin.mat'
Or
filename1 = 'TrialMax.mat'
Or
filename1 = 'TrialMean.mat'
I then want to be able to run my next line of code depending on the characters in the string.
If filename1 contains Max...
do this
elseif filename1 contains Min...
do this
I hope this makes sense and any help would be much appreciated
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Workspace Variables and MAT Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!