Saving and Loading ECG data (.mat)

19 views (last 30 days)
Hello. my query is when I load my ECG_Save variable, it does open saved ecg signal along with figure as well. I don't understand why figure open when I load ECG_Save variable ? I only want to see ECG_Save signal when I load it. it seems like figure also saved in ECG_Save data. how can I omit figure when I load data ?
I think I have some problem with this command in the below code : ECG_Save = ECG.Save;
The ECG code is :
while(ishandle(MainFigure_ECG))
ECGCrudeData = fscanf(Serialport, '%s');
ECG.Save(ECG.DataCursor) = str2double(ECGCrudeData);
end
save(['ECG_' datestr(now,30)]);
toc(For1sec)
close all
fclose(Serialport);
fclose(instrfind);
Anothe Script for loading and analyse ECG data: (here figue + ecg signal both shows -> I require only ecg signal here not figure)
load('ECG_20210426T224428.mat');
a=(ECG_Save(1,:));
figure;
plot(a);

Accepted Answer

Walter Roberson
Walter Roberson on 26 Apr 2021
When you call save() and do not specify any variable names, then it will save all the variables in the current workspace. Including for example, the result of having called
MainFigure_ECG = figure(41);
You should avoid calling save() with no variable names, or else you should only do the save() from within a function that has a limited number of variables.
  8 Comments
Walter Roberson
Walter Roberson on 27 Apr 2021
Interesting, I had not encountered that ability before.
Sarfaraz Ahmed
Sarfaraz Ahmed on 27 Apr 2021
Thank you for such assistance.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!