compare string

i want to ask about compare string
i want to select file use this code
[FileName,PathName] = uigetfile('*.jpg','Select the jpg-file');
handles.gambar=imread(fullfile(PathName, FileName));
image(handles.gambar)
axis off
guidata(hObject, handles);
could i compare the filename of the image that i've selected ?
for example the image filename is "image1"
TF = strcmp(handles.gambar,image1)
if i choose the right image the TF would become 1, if wrong then it would become 0..
i already try to compare it but error any suggest ? sorry if my english is bad

 采纳的回答

Matt Fig
Matt Fig 2011-6-13
If you want to compare the name of the file, use the result returned from UIGETFILE. Of course if this will be used later, you will need to store it in GUIDATA.
[FileName,PathName] = uigetfile('*.jpg','Select the jpg-file');
TF = strcmp(FileName,'image1.jpg')

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Convert Image Type 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by