Is there a way to load data from an Excell file making sure that this is Saved?

In one of my projects, I am constantly editing input data for a Matlab program in an .xlsx file. Each time I run the Matlab program, this reads the specifie column of the .xlsx file and continues running the program. However, if I forget clicking save in the Excell file before running the Matlab, the changed values are not loaded into Matlab Workspace.
Thus, my question is if there is a way to make sure .xlsx file is saved before reading the data from it.
Hope I explained myself properly.
Thank you very much in advance.

3 Comments

Windows with Excel installed? If so then maybe you could use ActiveX to command that the data be saved.
Yes Is Windows with Excell Installed. I dont' know that command, but I will check. Thanks
I am trying to go throught ActiveX, however I can see it is a complex programing tool, that makes possible the comunication between Matlab and Excell in many different ways. I would only like to make saveing. Could you please tell me what should I write/use for that?

Sign in to comment.

Answers (1)

This means, that you use Excel as GUI of Matlab. This is a bold approach. What about proramming the GUI in Matlab directly?
Use "Save" instead of the "Saveas"

6 Comments

Yes tha's true. However, I have several cases and each of the cases has 20 properties so I prefer having each case in an Excell column and choosing the column I want instead of typing each time the properties in a Matlab GUI.
I looked at the demo in the link you proposed, however from what I understood that code is to create an excell file from Matlab, operate with it and save it.
However, what I only want to do is open a specific ecell file, whch is already full of the desired values and SAVE it, before loading the data to Matlab workspace.
I tried:
DataFile = strcat(pwd,'\InputDataSpline.xlsx');
Excel = actxserver('Excel.Application');
invoke(Excel.ActiveWorkbook,'Save');
However I got the error:
Check for missing argument or incorrect argument data type in call to function 'invoke'.
Error in GenSpline_v14 (line 62)
invoke(Excel.ActiveWorkbook,'Save');
I tried some methods also. Whenever I've edited an Excel file, which was opened by Matlab, I cannot access the methods anymore due to the error: "Error: Call was rejected by callee."
What about importing the data and displaying them in a uitable object? There you do not need the complex interaction between Excel and Matlab.
Perhaps it is the option, but I have no idea how to do that. Could you send any link?
Thanks Jan! I have a problem with readtable, as there are text values inside my excell table and they are not properly loaded into the table created in matlab. How can I make all the data is properly displayed and loaded?
Here excell info:
Here the uitable generated in matlab:

Sign in to comment.

Products

Release

R2020a

Asked:

on 2 Feb 2021

Commented:

on 5 Feb 2021

Community Treasure Hunt

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

Start Hunting!