MATLAB Answers

Is there a way to record the usage of executable file in MATLAB?

1 view (last 30 days)
Hi
We have a team of 15 members. I want to record the usage of executable file (.exe) created in matlab. And i want to save the usage details ( like person name or mail id and time) every time they have opened the .exe file and the same has to saved in common place (lets say in google sheet). Is that possible in matlab?
  4 Comments

Sign in to comment.

Accepted Answer

Parker Morse
Parker Morse on 1 Jul 2021
I understand you want to log data to a shared file whenever a user opens a compiled function created with MATLAB Compiler. It might help to break this goal down into several parts, work on them separately, and then put them together to do what you want. I see three parts here, which you can probably work on in any order.
One, you will want to obtain and build the data you're going to log. There are a lot of ways to do this, depending on the data you're looking for. @Adam Danz's comment links to a good start: https://www.mathworks.com/matlabcentral/answers/14943-how-to-find-out-computername-and-username
Two, you will need to plan your connection to the shared log file. How you do this will depend on where that file will reside (e.g. on a local network drive or on a cloud service like Google Drive). This looks like one way to do it for Google Sheets: https://www.mathworks.com/matlabcentral/fileexchange/59359-matlab-to-google-sheets-matlab2sheets. There are almost certainly more ways in the Data Import and Export documentation.
Note that when you are connecting to the network you will want to include error handling so your compiled code does not crash if the user is not online or doesn't have appropriate permissions to write to the shared file. Wrapping the file access in a try block is a good way to do that.
Three, you will need to call the functions to build the log data and write it at an appropriate time in your program. Where you do this will depend on the structure of your program. You may want to consider using 'isdeployed' to run this on deployed instances of your program.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by