MATLAB Answers

how to approach a for loop problem where data needs to be saved automatically after taken?

10 views (last 30 days)
Fatematuz zahura
Fatematuz zahura on 22 Sep 2021 at 18:19
Commented: Image Analyst on 24 Sep 2021 at 13:04
i am working on this project where we are taking ecg and ppg signals from subjects. there will be three sets of data before the intake of green tea, three sets of data after thirty minutes of having green tea, three sets of data after sixty minutes of taking green tea. so each time we have to set the name of the data taken and manually save it. i am seeking for help on how to get started with the code where after the signal is taken it will ask the user if he wants to save it and the name of it on matlab. simple steps on getting started would be apprecciated!

Answers (1)

Image Analyst
Image Analyst on 23 Sep 2021 at 2:42
Here's snippet to save the name of a file to get you started:
% Get the name of the file that the user wants to save.
% Note, if you're saving an image you can use imsave() instead of uiputfile().
startingFolder = userpath % Or "pwd" or wherever you want.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
  2 Comments
Image Analyst
Image Analyst on 24 Sep 2021 at 13:04
It's well commented and explained. If you need further explanation of fullfile() and uiputfile() just see the documentation. I don't want to simply copy and paste their explanations in the help here when you can just simply look them up.

Sign in to comment.

Categories

Community Treasure Hunt

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

Start Hunting!

Translated by