Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
Bart
Bart am 1 Dez. 2014
Kommentiert: Bart am 1 Dez. 2014
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.

Akzeptierte Antwort

Guillaume
Guillaume am 1 Dez. 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 Kommentar
Bart
Bart am 1 Dez. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by