Suggestions about GUI development

조회 수: 3 (최근 30일)
mz123
mz123 2019년 6월 5일
편집: Adam 2019년 6월 6일
Good afternoon,
I have in mind a simple project but I'm not sure how to start it. Currently I'm using an Excel spreadsheet where every day I put in one single value coming from an instrument and I plot it to see if it lies within some low/upper limit. It is a very basic control chart.
I did a very stupid script in Matlab, where I generate a random number let's say 2.00, add it to an array D(1,1), plot the array, save the variable and exit. Next run, I load again D, I generate another new random number and I save it in D(2,1) and so on... so D has no a fixed dimension... it is continued updated every day. This process relies to the fact that I have to save and load the numeric array from the workspace to be plotted/updated.
I'd like to do it in a more elegant way, but I have no clues. My ambition is to create an .exe file which will consist of a simple GUI containing buttons and of course the graph.
Is there a way to save past data within the GUI, so that every time I launch the .exe I can see the plot with all the values?
That is my idea at the moment, but I'm open to suggestions or other techniques to accomlish the task.
Thanks

채택된 답변

Blaise Konzel
Blaise Konzel 2019년 6월 5일
Saving past data and repopulating it everytime you open the GUI is relatively simple. I am not so sure that I understand what you are asking about the .exe file. A simple way to save past info in GUI's is to write your data code in the function that initiates the GUI opening. You can do this by calling another function from that opening function and sending with it the array you are editing everyday and saving it to a localized file on your computer(probably excel). Everytime you enter a value it will be saved in that file and everytime you open the GUI that file will be opened and populate your matlab array. Hope this made sense.
Look more into opening excel files in matlab here : https://www.mathworks.com/help/matlab/ref/xlsread.html
  댓글 수: 4
Rik
Rik 2019년 6월 6일
Another solution would be to use getpref and setpref. Those also store data to a file, but where that file is, is hidden from the user.
mz123
mz123 2019년 6월 6일
Yes of course, much lighter and flexible.
Thank you for your help.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by