想問一下為什麼打好這串後,能跑出選圖的選項但圖卻跑不出來的問題在哪裡QAQ
function test
f = figure('Visible','off');
file_name= uigetfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
myimg=imread(file_name);
imshow(myimg);
newmap='tif';
save myimg;
save newmap;
str1={'jpg','png','bmp','tif'};
popup = uicontrol('Style', 'popup',...
'String', str1, ...
'Position', [20 340 100 50],...
'Callback', @()setmap);
btn1 = uicontrol('Style', 'pushbutton', 'String', 'Gray',...
'Position', [20 20 50 20],...
'Callback', @()Gray);
btn2 = uicontrol('Style', 'pushbutton', 'String', 'BW',...
'Position', [80 20 50 20],...
'Callback', @()BW);
btn3 = uicontrol('Style', 'pushbutton', 'String', 'SAVE',...
'Position', [140 20 50 20],...
'Callback', @save_img);
sld = uicontrol('Style', 'slider',...
'Min',1,'Max',50,'Value',41,...
'Position', [400 20 120 20],...
'Callback', @()surfzlim);
txt = uicontrol('Style','text',...
'Position',[400 45 120 20],...
'String','Vertical Exaggeration');
set(f,'Visible','on');
function setmap()
val = get(gcbo,'Value');
maps = get(gcbo,'String');
newmap = maps{val};
save newmap;
end
function save_img()
load myimg; load newmap;
file_name= uigetfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
disp(strcat(file_name,'.',newmap));
imwrite(myimg, strcat(file_name,'.',newmap), newmap);
end
function BW()
end
function Gray()
end
function surfzlim()
val = 51 - get(gcbo,'Value');
zlim([-val val]);
end
end
function test
f = figure('Visible','off');
file_name= uigetfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
myimg=imread(file_name);
imshow(myimg);
newmap='tif';
save myimg;
save newmap;
str1={'jpg','png','bmp','tif'};
popup = uicontrol('Style', 'popup',...
'String', str1, ...
'Position', [20 340 100 50],...
'Callback', @()setmap);
btn1 = uicontrol('Style', 'pushbutton', 'String', 'Gray',...
'Position', [20 20 50 20],...
'Callback', @()Gray);
btn2 = uicontrol('Style', 'pushbutton', 'String', 'BW',...
'Position', [80 20 50 20],...
'Callback', @()BW);
btn3 = uicontrol('Style', 'pushbutton', 'String', 'SAVE',...
'Position', [140 20 50 20],...
'Callback', @save_img);
sld = uicontrol('Style', 'slider',...
'Min',1,'Max',50,'Value',41,...
'Position', [400 20 120 20],...
'Callback', @()surfzlim);
txt = uicontrol('Style','text',...
'Position',[400 45 120 20],...
'String','Vertical Exaggeration');
set(f,'Visible','on');
function setmap()
val = get(gcbo,'Value');
maps = get(gcbo,'String');
newmap = maps{val};
save newmap;
end
function save_img()
load myimg; load newmap;
file_name= uigetfile ({'*.gif;*.png;*.jpg', 'Supported Picture Formats'});
disp(strcat(file_name,'.',newmap));
imwrite(myimg, strcat(file_name,'.',newmap), newmap);
end
function BW()
end
function Gray()
end
function surfzlim()
val = 51 - get(gcbo,'Value');
zlim([-val val]);
end
end