问题描述
我想查看检测"功能的结果.在检测"功能中,存在消息"变量.从功能上,我希望可以特别在UIPANEL中在GUI中预览messeges变量中的所有句子.
I wanna view the result of the "Detection" function. In the "Detection" function there is "messeges" variable. From the function, i want that all the sentences in messeges variable can be preview in my GUI esspecially in UIPANEL.
操作方法.我已经在matlab中使用tag = uipanel1进行了面板设计.
How to do it. I have made a Panel design in matlab with tag=uipanel1.
[messeges]=Detection(handles.citra1); %it's to call the Detection
function.
这是我的UIPANEL代码.
here is my UIPANEL CODE..
hp1=uipanel('Position', [100 100 700 500],...
'Title','UI Panel 1');
set(hp1, [messeges]);
但是它不能将messeges变量中的句子显示到我之前做过的panel1中.
but it cannot display the sentences from the messeges variable into the panel1 that i had made before..
有这样的错误信息
??? Error using ==> set
There is no 'jumlah pasang pixel yang pada objek 13
adalah 1000' property in the 'uipanel' class.
Error in ==> deteksi2citra>pushbutton3_Callback at 124
set(hp1, [messeges]);
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> deteksi2citra at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)deteksi2citra('pushbutton3_Callback',
hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
我找到了相关的主题,但是找不到解决方案.
I have find the rellated topic but i cannot find the solution.
请帮助我.
推荐答案
您的代码存在三个主要问题.
There are three major problems with your code.
-
您始终必须将对象的属性设置为 Matlab 中的 something . /p>
You always have to set a property of an object to something in Matlab.
set(Object_Handle,'PropertyName1',PropertyValue1,...
'PropertyName2',PropertyValue2...)
因此,您也许可以编写此set(hp1, 'String', messages);
,但不能编写set(hp1, [messages]);
Thus you might be able to write this set(hp1, 'String', messages);
but never set(hp1, [messages]);
uipanel
只是一个容器对象,这意味着它可能包含其他GUI对象.您可以放置text
或edit
(请参见 uicontrol
)在 uipanel
中包含您的字符串.但是 uipanel
本身没有'String'
属性.
uipanel
is just a container object, which means that it could contain other GUI objects. You could put a text
or edit
(See uicontrol
) containing your string in the uipanel
. But the uipanel
itself does not have a 'String'
property.
的 position
向量 uipanel
默认为normalized
.因此,所有位置值必须在0
和1
之间.有关更多信息,请参见此处. /p>
The position
vector of uipanel
is normalized
by default. So all the position values must be between 0
and 1
. See position vector here for more info.
将多行 text
放入uipanel
的示例:
(请注意,此代码是独立代码或自洽代码(不同于 GUIDE ),因此您只需复制并粘贴此代码,然后在matlab命令窗口中运行它即可.)
Example of putting multi-line text
in uipanel
:
(Note that this code is a standalone or self consistent code (unlike GUIDE), thus you can just copy and paste this code and run it in matlab command window.)
str = sprintf('Your \n Multiline \n String ...');
hp1 = uipanel('Title','UI Panel 1',...
'Position', [.25 .1 .67 .67]);
uicontrol(...
'Parent', hp1,...
'Style','text',...
'Units', 'Normalized', 'Position', [0 0 1 1],...
'String', str);
这篇关于如何在Matlab中查看uipanel的多于1行的句子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!