设为首页 加入收藏

TOP

一个简单的matlab图形界面程序GUI(六)
2014-11-24 03:17:23 来源: 作者: 【 】 浏览:5
Tags:一个 简单 matlab 图形 界面 程序 GUI
t(handles.endValue,'String','1');
end


function gui_update_names(handles, tag)
if strcmp(tag, 'test') == 1
set(handles.name11, 'String', 'setment map');
set(handles.name12, 'String', 'object detection result');
set(handles.name21, 'String', 'human label information');
set(handles.name22, 'String', 'label and detection res.');
elseif strcmp(tag, 'maps') == 1
set(handles.name11, 'String', 'origin image');
set(handles.name12, 'String', 'defocus map');
set(handles.name21, 'String', 'saliency map');
set(handles.name22, 'String', 'segment map');
end

function gui_update_axes(imageName, axespos, handles, class)
% refresh the axes content using imageName
if nargin < 4
class = 'image';
end
if axespos == 11
axes(handles.axes11);
elseif axespos == 12
axes(handles.axes12);
elseif axespos == 21
axes(handles.axes21);
elseif axespos == 22
axes(handles.axes22);
end
if strcmp(class,'image') == 1
im = imread(imageName);
elseif strcmp(class,'im') == 1
im = imageName;
else
disp('error in using gui_update_axes');
end
imshow(im);

function st = runtime_number_check(handles, no)
% check the runtime wether between in [1, 10]
if isnan(no)
msgbox('You must entry a number value','InputError', 'modal');
st = -1;
return;
elseif no <= 0 || no > 10
msgbox('Input number must between [1,10]!!','Attention','modal');
st = -1;
return;
else
st = 1;
return;
end


function st = file_check(filename)
% check the file wether exists
if exist(filename, 'file') ~= 0
st = 1;
else
msg = sprintf('% the file: %s does not exist!', filename);
msgbox(msg,'FileReadError', 'modal');
st = -1;
end

function st = imgno_number_check(no, handles)
% check the image order whether legal
maxValue = get(handles.sliderImageNo, 'Max');
minValue = get(handles.sliderImageNo, 'Min');
if isnan(no)
msgbox('You must entry a number value','InputError', 'modal');
st = -1;
elseif no <= 0
msgbox('Input number must be positive!!','Attention','modal');
st = -1;
elseif no>maxValue
msgbox(['Input number exceed the max value (',num2str(maxValue),')!!'],...
'Attention','modal');
st = -1;
else
if (no - 1) == (minValue - 1)
st = 2;
elseif (no + 1) == (maxValue + 1)
st = 3;
else
st = 1;
end
end


function running_testfunc(handles);
% running test fuction after we have trained
% classify model and segmentations
message = ['running command pressed'];
startI = floor(str2double(get(handles.beginValue, 'String')));
endI = floor(str2double(get(handles.endValue, 'String')));
if imgno_number_check(startI, handles) ~= -1 && ...
imgno_number_check(endI, handles) ~= -1
msg = sprintf('%s\n i=%d:%d', message, startI, endI);
set(handles.msg, 'string', msg);
else
set(handles.msg, 'string', message);
end


界面如下:



把上面代码保存到文件:showGUI.m


下载这里的showGUI.fig文件,把它们放在同一个目录下运行showGUI.m文件就可以了。


showGUI.fig文件下载:


具体下载目录在 /2013年资料/6月/14日/一个简单的matlab图形界面程序GUI


首页 上一页 3 4 5 6 下一页 尾页 6/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇如何用Java实现获得MySQL数据库中.. 下一篇队列的多种C语言实现

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·C语言中如何将结构体 (2025-12-24 22:20:09)
·纯C语言结构体成员变 (2025-12-24 22:20:06)
·C语言中,指针函数和 (2025-12-24 22:20:03)
·哈希表 - 菜鸟教程 (2025-12-24 20:18:55)
·MySQL存储引擎InnoDB (2025-12-24 20:18:53)