Effacer les filtres
Effacer les filtres

How to set the XTick value based on a user defined variable in a GUI?

1 vue (au cours des 30 derniers jours)
Jeremy
Jeremy le 29 Juin 2017
Hi all,
I am currently trying to make my axis tick distances vary based on the type of image that is being inserted into a GUI. I have two radio buttons that define a variable value. The variable should then correlate to the distance for each of the tick marks through a function. The code is shown below.
function bitvalue_Callback(source,eventdata)
source
type1 = strcmp(source.String, '64bit');
type2 = strcmp(source.String, '128bit');
if strcmp(source.String, '64bit')
set(S.rbDF_64bit,'Value',1);
set(S.rbDF_128bit,'Value',0);
bitvalue = 64;
else
set(S.rbDF_64bit,'Value',0);
set(S.rbDF_128bit,'Value',1);
bitvalue = 128;
end
end
function pbDF1_Mon_Callback(source,eventdata)
source
get (bitvalue);
[ImFile,folder] = uigetfile('H:\New_CHAR_GUI\New Version 04\Sample Data\*.*');
Im = imread(fullfile(folder,ImFile));
ImPos = strcmp(source.String,'Insert 1');
if ImPos == 1
Im_axes = axes('Parent',S.tab(tab_num),'Units',...
'normalized','Position',[0.015 .02 .98 1]);
S.hDFplot = axes('Parent',S.tab(tab_num),'Position',[0.015 0.375 0.98 .287], 'color','none','XAxisLocation','top',...
'Xlim',([0,102]),'XTick',linspace(0,102,(bitvalue./52)),'fontsize',7,'Ylim',([0,700]),'YDir','reverse','YColor','none');
xlabel('Delay / {\mu}s','FontSize',8)
box on
grid on
grid minor
tex_ax_Pos = [S.hFPWplot_Pos(1) 0.05 S.hFPWplot_Pos(3) 0.1];
tex_ax = axes('Parent',S.tab(tab_num),'Units','normalized','Position',tex_ax_Pos);
set(tex_ax,'Visible','off','Color',[242/255 242/255 242/255])
else
Im_axes = axes('Parent',S.tab(tab_num),'Units',...
'normalized','Position',[0.015 -.327 .98 1]);
S.hDFplot = axes('Parent',S.tab(tab_num),'Position',[0.015 0.030 0.98 .287],...
'color','none','XAxisLocation','top',...
'Xlim',([0,102]),'XTick',linspace(0,102,(bitvalue./52)),'fontsize',7,'Ylim',([0,700]),'YColor','none');
xlabel('Delay / {\mu}s','FontSize',8)
box on
grid on
grid minor
tex_ax_Pos = [S.hFPWplot_Pos(1) 0.05 S.hFPWplot_Pos(3) 0.1];
tex_ax = axes('Parent',S.tab(tab_num),'Units','normalized','Position',tex_ax_Pos);
set(tex_ax,'Visible','off','Color',[242/255 242/255 242/255])
end

Réponses (0)

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by