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 6586003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:44:07+00:00 2026-05-25T16:44:07+00:00

I’m currently refactoring a bunch of old Matlab code (pre new-oop Matlab), and the

  • 0

I’m currently refactoring a bunch of old Matlab code (pre new-oop Matlab), and the GUI code is a mess.

The GUI is basically a bunch of separate Matlab figures, each of which must present the same data in a different way.

The old code handles this problem by using a global struct to hold all of data to be displayed along with the meta-data (mainly information about the size needed to graph the current data).

My question is whether or not this is the right way, stylistically, to do this in the current version of Matlab. I’ve considered bundling the data into a handle class and the meta-data into another, and then passing both to every figure in the GUI, but I don’t know if the added encapsulation is worth the messiness of the added arguments.

Are there any general style rules for making such decisions in Matlab GUI programming?

  • 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-25T16:44:08+00:00Added an answer on May 25, 2026 at 4:44 pm

    There are a couple ways to do this. You can use getappdata and setappdata to associate data with an individual figure:

    %# Associate some data to the main figure handle...
    setappdata(main_FH, 'myData', data);
    
    %# Retrieve that data from the main figure handle
    myData = getappdata(main_FH, 'myData');
    
    %# check if some app data exists for main_FH
    validAppData = isappdata(main_FH, 'myData');
    

    You could also use set(FH, 'UserData', myData) (and get() too), although there’s only one UserData property for every handle; you could set it to a struct and use isfield() rather than isappdata() to see if the field in myData exists.

    Finally, there’s guidata, but this is essentially a wrapper for ___appdata for GUIDE GUIs.

    There’s a summary of the ways to pass data like this on The MathWorks website.

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

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm parsing an XML file, the creators of it stuck in a bunch social
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a bunch of posts stored in text files formatted in yaml/textile (from

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.