Change axis property in GUIDE

3 views (last 30 days)
An Tran
An Tran on 7 Oct 2017
Answered: Rik on 24 Oct 2017
Hello,
I am trying to change the axis properties using code. This is what I have so far:
axes(handles.EEGAxes)
axes('XTick',0:5:(cislo)/fvz,'YTick',225:100:pocet*100+200,'YTickLabelMode','manual','YTickLabels',popis(nazvy_kanalu(1:pocet)+1)) % popisky osy y,x
tried this aswell
%set(axes, 'XTick', 0:5:(cislo)/fvz);
%set(axes, 'YTick', 225:100:pocet*100+200);
%set(axes, 'YTickLabelMode', 'manual');
%set(axes, 'YTickLabels', popis(nazvy_kanalu(1:pocet)+1));
the result is still the same (pic below)
How can I remove the extra axis which were created?
This is how it looks like in default state
properties of axis in default state:

Answers (1)

Rik
Rik on 24 Oct 2017
Why not use the set command directly on your handle?
set(handles.EEGAxes, 'XTick', 0:5:(cislo)/fvz);
set(handles.EEGAxes, 'YTick', 225:100:pocet*100+200);
set(handles.EEGAxes, 'YTickLabelMode', 'manual');
set(handles.EEGAxes, 'YTickLabels', popis(nazvy_kanalu(1:pocet)+1));
This should not create a new axis object.
It is always best to use explicit assignments, because if you use functions like gca or gcf, user might have switched to another axis or figure in the mean time, which would render your code non-functional.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!