필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Bart
Bart 2014년 12월 1일
댓글: Bart 2014년 12월 1일
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.

채택된 답변

Guillaume
Guillaume 2014년 12월 1일
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
Bart
Bart 2014년 12월 1일
Thanks, thats exactly what i needed! I'll just play around with it now and hope i'll get to know how it works.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by