Saving/storing data from plot

I'm running a gui. I have 2 axes, both with the same x-axis(frequency), but the y axes are E1 & E2 respectively. After plotting them, I need a push button to save the data into a .dat file with three columns (freq, E1,E2). Then, I need a method to import the saved/stored data back into the gui using another push button. Can anyone help? thanks in advance

댓글 수: 6

nl2605
nl2605 2013년 7월 19일
Do you want to save the data being plotted or the plot itself?
James Hendren
James Hendren 2013년 7월 22일
i want to save the data being plotted
dpb
dpb 2013년 7월 22일
So what's wrong w/ previous answer?
James Hendren
James Hendren 2013년 7월 22일
I was just commenting back
dpb
dpb 2013년 7월 22일
Ahhh, so...sorry; thought you were having troubles yet.
James Hendren
James Hendren 2013년 7월 22일
what is the difference between command and functional form?

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

 채택된 답변

dpb
dpb 2013년 7월 19일
편집: dpb 2013년 7월 22일

0 개 추천

If the point is only to save the data for recall at a later time then just use SAVE and LOAD and save as .mat file. You automagically get full precision
For SAVE button callback would contain one of the following
save FEfile f E1 E2 % command form
save('FEfile' 'f' 'E1' 'E2') % functional form
Need to make the data available of course; use [set|get]appdata to get it between one callback and another or retrieve it directly from the plot handles or other fashion.
The IMPORT button callback would contain either
load FEfile f E1 E2 % command form
load('FEfile' 'f' 'E1' 'E2') % functional form
The SAVE function adds sufficient info into the file that the variable names/sizes are known. The LOAD will retrieve the variables named into those names in the workspace.
If you really, really must have ASCII, look at dlm[write|read] and friends. Look at
help iofun
note the list under File Import/Export functions and select what seems most suitable to your purposes.

추가 답변 (1개)

James Hendren
James Hendren 2013년 7월 22일

0 개 추천

I am having a problem. I had the frequency and E1 and E2 as globals, so would the format for saving them on the push button be different? Does there need to be a set|get appdata for that? If so how would I do it?

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

질문:

2013년 7월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by