First, you will need to make sure that you suppress any output in the command window. You can do this by making sure that you end the lines with a semicolon , avoid using DISP to display data, and do not use the FPRINTF function to send data to standard output (i.e. the command window).
-, , "" . , UITABLE ( Azim , MATLAB). , , . :
hList = uicontrol('Style','text','Position',[100 100 200 200]);
set(hList,'String',{'Line 1'; 'Line 2'}); % Displays 2 lines, one string each
vec = rand(3,1); % Column array of 3 random values
set(hList,'String',num2str(vec)); % Displays 3 lines, one number per line
, , .
.. , , , . . , "FontSize" , ( ) , , .
EDIT: ...
, - , , , , . , , ( ) , .
-, m :
callback_scrolltext.m
function callback_scrolltext(source,event,hText)
textString = get(hText,'UserData');
nLines = numel(textString);
lineIndex = nLines-round(get(source,'Value'));
set(hText,'String',textString(lineIndex:nLines));
end
update_scrolltext.m
function update_scrolltext(newText,hText,hSlider)
newText = textwrap(hText,newText);
set(hText,'String',newText,'UserData',newText);
nRows = numel(newText);
if (nRows < 2),
sliderEnable = 'off';
else
sliderEnable = 'on';
end
nRows = max(nRows-1,1);
set(hSlider,'Enable',sliderEnable,'Max',nRows,...
'SliderStep',[1 3]./nRows,'Value',nRows);
end
-, GUI . "" , , hParent:
hParent = figure;
hText = uicontrol('Style','text',...
'Parent',hParent,...
'Units','pixels',...
'Position',[100 100 100 40]);
hSlider = uicontrol('Style','slider',...
'Parent',hParent,...
'Units','pixels',...
'Position',[200 100 10 40],...
'Enable','off',...
'Callback',{@callback_scrolltext,hText});
, , , update_scrolltext , ( , TEXTWRAP is) . :
update_scrolltext({'hello'},hText,hSlider);
update_scrolltext({'hello'; 'there'; 'silly'; 'world'},hText,hSlider);
! =)