How to get matlab to save acquired user input in a file/profile?

3 views (last 30 days)
Hi,
I'm trying to collect information (car specifications) through a dialog-box, and then save this into a file/profile or something. So when you run the script a dialog-box pops up and you get to fill in blanks and then the script will put this information into a file and save this. Thereafter matlab will spit out all the data which can be calculated with the given information. Can someone explain me how to get matlab to save user input in a file, and how to recall this later? I'd be very thankful for your help.

Accepted Answer

Guillaume
Guillaume on 1 Dec 2014
You have plenty of options:
  1. Collect your input however you want into some variables (cell arrays, matrices, tables, whatever) and save these in a .mat file with save. To get the data back, just load the .mat file. Advantage: dead simple. Disadvantages: can only be read by matlab. Have to read or write everything at once.
  2. Same, but use a .mat file per user, and another main.mat file to keep track of the individual files. Advantages: fairly simple. A file per user. Disadvantage: can only be read by matlab.
  3. Save your data in a table. And use writetable, readtable to save/restore the data. Advantages: fairly simple, nice organisation of the data. Can be read by other software. Disadvantage: Everything in one file
  4. Save and read the data yourself using low level functions. Advantage: Use whatever format you wish (xml, json, etc.). Disadvantages: More code to write
  5. Save the data in a database. Advantage: Exactly designed for this type of storage. Disadvantages: requires the database toolbox or a fair amount of coding using COM or .Net interface.
  6. Use OOP, with objects representing your data. And save these objects as .mat file. Advantages: OOP advantages: encapsulation, inheritance, etc. Disadvantages: require a fair amount of coding.
  1 Comment
Bart
Bart on 1 Dec 2014
Thanks, thats exactly what i needed! I'll just play around with it now and hope i'll get to know how it works.

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!