Gui to app designer

9 views (last 30 days)
SOYUN LEE
SOYUN LEE on 18 Jun 2020
Answered: Aniket on 21 Nov 2024 at 5:01
It's a gui code. Please change it to the code used by the app designer.
function clmap_Callback(hObject, eventdata, handles)
global g;
get(handles.figure1,'SelectionType');
if strcmp(get(handles.figure1,'SelectionType'),'normal')
index_selected = get(handles.listbox1,'Value');
file_list = get(handles.listbox1,'String');
filename = file_list{index_selected};
if handles.is_dir(handles.sorted_index(index_selected))
if strcmp(filename,'..')
handles.dfolder = fileparts(handles.dfolder);
% cd (filename)
load_listbox(handles.dfolder,handles)
elseif strcmp(filename,'.')
else
handles.dfolder = fullfile(handles.dfolder,filename);
% cd (filename)
load_listbox(handles.dfolder,handles)
end
else
fname = strtrim(filename);
fullname = fullfile(handles.dfolder , fname);
try
metadata = dicominfo(fullname);
catch
disp ('apparently not a DICOM file');
return
end
img = dicomread(fullname);
g.img=img;
clim =get(gca,'Clim');
clbarstat = get(handles.uitoggletool3,'State');
himg=imagesc(img);
set(himg,'ButtonDownFcn',@axes1_ButtonDownFcn);
set(himg,'UIContextMenu',handles.clmap);
if clim~=[0 1]
set(gca,'Clim', clim);
end
axis off
if strcmp(clbarstat,'on')
colorbar
end
ch = get(handles.HeaderList, 'value');
fields=char(fieldnames(metadata));
len = setdiff (1:size(fields,1), handles.hidden);
id=0;
for k=len,
estr=eval(['metadata.' fields(k,:)]);
if ischar(estr)
str=[fields(k,:) ' : ' estr];
elseif isnumeric(estr)
str=[fields(k,:) ' : ' num2str(estr(1:min(3,end))')];
else
str=[fields(k,:) ' : ...'];
end
id = id+1;
cstr{id}=sprintf('%3d %s',k,str);
end
set(handles.HeaderList,'Value',ch);
set(handles.HeaderList,'String',cstr);
guidata(hObject, handles);
return;
end
end
  1 Comment
Sampath Rachumallu
Sampath Rachumallu on 26 Jun 2020
Edited: Sampath Rachumallu on 26 Jun 2020
There is a matlab addon called "GUIDE to App Designer Migration Tool for MATLAB" . You can install it and use it to migrate guide gui to Appdesigner gui.

Sign in to comment.

Answers (1)

Aniket
Aniket on 21 Nov 2024 at 5:01
You can convert your GUIDE app into App Designer depending on the MATLAB version you are using:
1. Starting with R2023a, you can run the migration tool from the MATLAB command line by downloading the tool and then calling the "appmigration.migrateGUIDEApp" function. To know more about this function, kindly follow this documentation:
2. For previous releases, you may use GUIDE to App Designer Migration Tool for MATLAB by MathWorks Team to convert app.
Hope this helps!

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!