Issue with MATLAB .exe seeing data in excel as stagnant data when I need it to be able to read with each run of the .exe
1 次查看(过去 30 天)
显示 更早的评论
I have a program that uses XLSread and XLSwrite.
The program takes in some excel data from an excel file, we do some math, then we output to the excel file and open it up for the user to see the output.
This program works perfect in the IDE, but when I make an .EXE and try the program that way, whatever the last data I had in the excel run in the IDE, is ALWAYS the output for the .exe now. Even when I change the data in the excel file and rerun.
How would I go about making this dynamic? Or have the program read in the new data from the excel file with each subsequent run?
example:
******************************************************************************
% read in some data
[num,txt,raw] = xlsread('excelFile','REPORT');
% do some math
x= 5 * num (1)
%export it back to excel file
xlswrite('excelFile',matrix,'sheet1')
%open the file up for the user
winopen('excelFile')
******************************************************************************
any and all help is greatly aprecaited!
,Billy
0 个评论
回答(1 个)
Walter Roberson
2023-6-28
read about ctfroot which is the directory that the code will be executing in, and the location that your named files will have been copied to.
The executable will NOT be running in the user's home directory. You will need to figure out the user directory by looking at windows environment variables. Caution: some of the folders named in the environment variables do not have drive letter, which is a different environment variable
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!