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

  • SEARCH
  • Home
  • 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 8031809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:13:08+00:00 2026-06-05T01:13:08+00:00

With Guide I made a Matlab Gui that have 10 Axes in which i

  • 0

With Guide I made a Matlab Gui that have 10 Axes in which i want to display images, in all of them at once, after i press a Button.

I made a separate .m file with function Load_Write_Img_Results(img_index) that i call from the Button Callback which have the following code:

for i = 1 : 10
    handles_imgOut = findobj('Tag', ['imgOut' num2str(i)]);
    set(handles_imgOut, 'HandleVisibility', 'ON');
    axes(handles_imgOut);
    image(imgs_data{img_index(i)});
    ...
end

Every time when i run the main Gui and press the button for the first time, images are displayed in all axes, so everything works ok.


The problem appear when i press the button for the second time and i get this error:

    Error using axes  
    Invalid object handle

on this line:

    axes(handles_imgOut);

When debugging, i saw that after handles_imgOut = findobj('Tag', ['imgOut' num2str(i)]); the handles_imgOut is not getting any value and is empty, so it’s obvious that error.

Is there any chance i can’t get handles for axes at the second press of the button?

Also, i want to know how can i solve this warning from Matlab:

Calling AXES(h) in a loop can be slow. Consider moving the call to AXES outside the loop.

Thanks in advance, any suggestions are welcome!


[SOLUTION]:

for i = 1 : 10
    handles_imgOut = findobj('Tag', ['imgOut' num2str(i)]);
    set(handles_imgOut, 'HandleVisibility', 'ON');
    axes(handles_imgOut);
    image(imgs_data{img_index(i)});

    set(gca, 'Tag', ['imgOut' num2str(i)]); //! renew the tag
    ...
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-06-05T01:13:09+00:00Added an answer on June 5, 2026 at 1:13 am

    The fact that it works on the first button press, but not thereafter hints that

    image(imgs_data{img_index(i)});
    

    opens new axes instead of drawing into the existing ones. Since the new axes are not initialized with your tags, findobj will not find them. Either

    (1) make sure to hold the original axes by placing a hold on command right after their creation,

    or

    (2) renew the tag right after the image command by

    set(gca, 'Tag', ['imgOut' num2str(i)]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database table transaction which stores all the transaction made by users
I have made a drag-to-trigger_event page based on this guide . I'm displaying list
So I made a landing page for all these forms that the marketing department
I have a double 2D image that I want to use in my UI
I am trying to write a MATLAB GUI that uses the XBee-API interface to
Friends i have made a location based application. i have implemented all the code
I have made an android app which working fine. I implemented the Login functionality
I have made a Android streaming application that plays media from online URL's. For
I have made a Linux CUI app that communicates between processes via Message-quene. There
I've been following the guide microsoft have made for setting up the Kinect SDK

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.