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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:08:35+00:00 2026-06-02T20:08:35+00:00

I would like to set in a file all constant,parameters and then I can

  • 0

I would like to set in a file all constant,parameters and then I can access from another class to any variable

for example const file const.m

FILE='file';
EDIT='edit';
COLOR_RED ='red',
COLOR_BLUE ='Blue'
START ='Start'
.....
...

and from any other files if I would like to access to any variable :

a = const.EDIT

so that I haven’t to set a =’file’ in each file.

How could I do that with matlab ?
how could also use enumeration ?

  • 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-02T20:08:37+00:00Added an answer on June 2, 2026 at 8:08 pm

    You don’t need a struct just use the save command: http://www.mathworks.com/help/techdoc/ref/save.html and specify which workspace variables you want to save. If there are small like in your example, they will be easy to read in notepad for access not in matlab. In matlab just use the load function.

    For example create two variable in matlab:

    Var1 = 'Red'
    Var2 = [1 2; 3 4]
    

    now type

    save('myData.mat');
    

    this should create a file called myData.mat in your current working folder.

    Now in another Matlab script you want to set a variable to have the value you saved as Var1 so you can go

    NewVar = load('myData.mat', Var1)
    

    And you can easily edit the values in the .mat file in a text editor such as notepad or gedit (or emacs or ms word or whatever) if you add the -ascii parameter when saving.

    But you can also rewrite a variable by using save() again and specifying the variable name.

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

Sidebar

Related Questions

I would like to deserialize all the data from the excel file to list.
I would like to set up a proxy object in the application NIB file.
I would like to apply FileIOPermission on set of files using mask in file
I would like to set some limits/boundaries on the amount of pixels we can
i would like to set the date format of all the dates in my
I would like to set some vim options in one file in the comments
Hey guys. I would like to set up the alias in my enviromental file
I would like to set a REDIS_ROOT in my redis.conf file and be able
I would like to set up a simple batch file that would loop through
I used the same command syntax above as in Mysql and would like set

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.