How to make an input data file used by compiled code available for editing?
Show older comments
I am compiling a set of functions which take an input file (ascii or .xlsx), use the data as inputs for a model, and then output the results to another file (ascii or .xlsx). When I compile the code, I include the output file in the list of "Files installed for your end user", and it outputs to the file.
However, the input file is read by the compiler as required for the functions to run, and is included in the "Files required for your application to run", and as a result seems to be compiled into the code, which means its not available for the end user to modify. This is probably a simple issue, but does anyone have recommendations on how to make the input file editable so end users can provide their own input files for a compiled Matlab function?
Graphically, the process should be like the following:
input_file (accessible to end user) ----> compiled_code (executed by end user) ----> output_file(accessible to end user)
However, compiling the code results in:
compiled_code_and_input_file ----> output_file.
Accepted Answer
More Answers (2)
Walter Roberson
on 31 May 2017
0 votes
Make a decision as to where the file must be stored relative to the user's directory structure. In your code, pull out the username and home directory and whatever else is necessary to figure out what the path would be to the current user. Build the name. Test to see if it exists; if it does then read from it. If it does not already exist, then read from your saved copy that you included with the application.
Categories
Find more on Introduction to Installation and Licensing 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!