How to open output of Matlab to new command line window

3 views (last 30 days)
I am totally new to matlab. I want to open output of matlab code on three times at different command windows to differentiate each other when click on button.directly change the code contents given below is appreciated.
% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton6 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton7 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
  6 Comments
Walter Roberson
Walter Roberson on 8 Oct 2017
figure() for new windows. uipanel() for creating sections within a window. uicontrol() for creating a text or edit area within a section.
To adapt Jan's answer slightly:
f1 = figure();
f2 = figure();
f3 = figure();
T1 = uicontrol('Parent', f1, 'Style', 'edit', 'Units', 'normalized', ...
'Position', [0, 0, 1, 1], ...
'Min', 0, 'Max', 2);
T2 = uicontrol('Parent', f2, 'Style', 'edit', 'Units', 'normalized', ...
'Position', [0, 0, 1, 1], ...
'Min', 0, 'Max', 2);
T3 = uicontrol('Parent', f3, 'Style', 'edit', 'Units', 'normalized', ...
'Position', [0, 0, 1, 1], ...
'Min', 0, 'Max', 2);
Samrajpal Guru
Samrajpal Guru on 10 Oct 2017
Thanks Walter, but still i dont get it. How to call or display command line output to figure or panel. I did as you told in above steps but still i dont understand how that output will be called in figure.

Sign in to comment.

Accepted Answer

Jan
Jan on 6 Oct 2017
There is one command window only, and this is a good idea. If a Matlab session have multiple command windows, it would not be clear, where warnings and error should occur.
If you want any output in a tricky layout, the command window is not the right location. Either open a figure with 3 edit fields:
figure;
T1 = uicontrol('Style', 'edit', 'Units', 'normalized', ...
'Position', [0, 0, 0.32, 1], ...
'Min', 0, 'Max', 2);
T2 = uicontrol('Style', 'edit', 'Units', 'normalized', ...
'Position', [0.33, 0, 0.32, 1], ...
'Min', 0, 'Max', 2);
T3 = uicontrol('Style', 'edit', 'Units', 'normalized', ...
'Position', [0.66, 0, 0.32, 1], ...
'Min', 0, 'Max', 2);
Now you can set the 'String' property of the edit fields as output:
set(T1, 'String', {'Hello', '', 'How are you?'});
Or create 3 text files and open them in the editor.

More Answers (0)

Categories

Find more on Creating, Deleting, and Querying Graphics Objects 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!