Saving data after pressing SAVE button in GUI MATLAB
Show older comments
I have five push buttons. The four pushbuttons are associated with different datas like for eg one is for age of female and their corresponding weight. Pushbutton2 is associated with data for age of male and their weight. Similarly pushbutton3 and pushbutton 4 relates to other data. There is also a SAVE pushbutton. When I press pushbutton1 and after that press SAVE pushbutton, I should be able to browse my system and give path for saving data in excel file. Similarly, I should be able to do for all other pushbuttons as well. I am not getting idea how to denote that one particular pushbutton is pressed. I was thinking of changing the background color of the button when I press it and relate it using if-else statement. I want my code in the SAVE button callback function sthg to be like:
If pushbutton1 is pressed
\\extract data, give directory and save data
else if pushbutton2 is pressed
\\extract data, give directory and save data
else if pushbutton3 is pressed
\\extract data, give directory and save data
else if pushbutton4 is pressed
\\extract data, give directory and save data
2 Comments
Geoff Hayes
on 23 Jun 2022
@Sush Gautam - what does pressing the buttons (1-4) actually do? Is something loaded? Are variables populated? You may want to add some sort of common behaviour to all four buttons so that it doesn't matter which button was pressed when you then press "save". i.e. you could save the data to one more variables (array, etc.) and then those variables would be used when saving to file.
Sush Gautam
on 23 Jun 2022
Accepted Answer
More Answers (0)
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!