Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6756501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:31:55+00:00 2026-05-26T13:31:55+00:00

I would like know how I could simplify(modify) the hSelecVarIndCallback function. I want to

  • 0

I would like know how I could simplify(modify) the hSelecVarIndCallback function. I want to avoid the repetition of the choices string for each case and be able to get an automatic choice of the string individual value.

function example
fh = figure;
hPan = uipanel(fh,'title','Main Panel','Units','characters',...
    'Position',[2.307 0 52 30],'FontSize',10,'FontWeight',...
    'bold','FontAngle','italic');
hInd = uipanel('Parent',hPan,'title','Variable(s)','Units',...
    'normalized','Position',[0 0.587 1 0.344],'FontSize',9,...
    'FontAngle','italic');
hSelecVarInd = uicontrol(hInd,'Style','popupmenu','Units','normalized',...
    'String',{'Time','Var 1','Var 2','Var 3','Var 4','Var 5','Var 6'},...
    'Value',1,'Position',[0.25 0.275 0.5 0.5],'FontSize',9,'Callback',...
    @hSelecVarIndCallback,'BackgroundColor','white');
hDep = uipanel(hPan,'title','Variable(s) Dependiente(s)','Units',...
    'normalized','Position',[0 0 1 0.5],'FontSize',9,'FontAngle','italic');
hDeplb = uicontrol(hDep,'Style','listbox','Units','normalized',...
                'String',{'Var 1','Var 2','Var 3','Var 4','Var 5','Var 6'},...
                'Max',2,'Min',0,'Value',1,...
                'Position',[0 0 1 1],'FontSize',9);
  function hSelecVarIndCallback(src,evt)

    val = get(hSelecVarInd,'Value');
if (val == 1)
    set(hDeplb,'String',{'Var 1','Var 2','Var 3','Var 4','Var 5','Var 6'});
elseif (val == 2)
   set(hDeplb,'String',{'Time','Var 2','Var 3','Var 4','Var 5','Var 6'});
elseif (val == 3)
   set(hDeplb,'String',{'Time','Var 1','Var 3','Var 4','Var 5','Var 6'});
elseif (val == 4)
   set(hDeplb,'String',{'Time','Var 1','Var 2','Var 4','Var 5','Var 6'});
   elseif (val == 5)
set(hDeplb,'String',{'Time','Var 1','Var 2','Var 3','Var 5','Var 6'});
   elseif (val == 6)
set(hDeplb,'String',{'Time','Var 1','Var 2','Var 3','Var 4','Var 6'});
else
set(hDeplb,'String',{'Time','Var 1','Var 2','Var 3','Var 4','Var 5'});   
end

  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:31:55+00:00Added an answer on May 26, 2026 at 1:31 pm

    Maybe you can do something like the following:

    function example
        %# list of all values
        varNames = {'Time','Var 1','Var 2','Var 3','Var 4','Var 5','Var 6'};
    
        %# create GUI
        fh = figure;
        hSelecVarInd = uicontrol(hInd, 'Style','popupmenu', ...
            'Units','normalized', 'Position',[0.25 0.275 0.5 0.5], ...
            'String',varNames, 'Value',1, 'Callback',@hSelecVarIndCallback, ...
            'FontSize',9, 'BackgroundColor','white');
        %# ... the rest here ...
    
        function hSelecVarIndCallback(src,evt)
            %# get selected value
            val = get(src, 'Value');
    
            %# all but the current value (logical mask)
            idx = true( size(varNames) );
            idx(val) = false;
    
            %# set the listbox
            set(hDeplb, 'String',varNames(idx));
        end
    end
    

    screenshot

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know if there is any way that I could build
I would like to know if an instance implements a specific method. I could
I would like to know how could I remove duplicate break lines with PHP
I would like to know how could I retrieve my jsf component value, when
I am using Facebook PHP SDK 3.0 I would like to know how could
I would like to know how could I resolve this problem(it's not a school
I would like to know how I could build a dialogbox in VB.net that
I would like to know if someone could provide example or a link on
I have a usb/bluetooth gps receiver and I would like to know how could
I use asp.net 4 and c#. I would like to know if could be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.