How do I let users read files (new data) into deployed compiled code?

조회 수: 3 (최근 30일)
I want to use (let others use) some matlab code as one of three (so far) codes used to perform simulations. I use a script to drive the simulations, and it works fine for the fortran and c (sourced) executables.
I really like the concept of deploying compiled Matlab code, and demonstrated that it indeed works for the Matlab code of interest. I included the input files for one example in the Build process.
Unfortunately, I cannot find out how to have new data files read into the executable - each user will want to process different information. I don't mind if the dozen or so filenames (holding the data and runtime options) need to be the same, but it is essential that the content of each file can change.

채택된 답변

owr
owr 2012년 6월 26일
Let them browse for it with some sort of UI. You can use functions like "uigetfile" to get the file name and path.
  댓글 수: 1
Timothy Cale
Timothy Cale 2012년 6월 26일
I hope for a code that requires no user interaction.
My goal is to have an executable that will serve as one of several codes performing simulations. I expect each of the codes to be called several times.
Some output from one code is written to data files, which are then read by the next code. This works find with my fortran and c sourced executables. I can read files from anywhere by reading their path into the code during execution.
So, one of my fortran codes writes data files (3 in this case) that are input for the target Matlab executable. In addition to these files, I also have a number (8) of files that are read at points in the, which tell the code some details - like what figures to show, and what to write out.
I tried simply putting the needed files in the directory in which I 'unpacked' the distribution, but that did not work. (Perhaps it should have?)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Timothy Cale
Timothy Cale 2012년 6월 27일
Well, I think I am red-faced wrt to wasting time/attention.
When I used (second time) the compiled/distributed code as I would/do use my fortran/c executables - for which I use extensive i/o to files in a variety of locations, it seems to work. (I don't know what I did wrong the first time I tried to use new files for i/o in compiled Matlab code . . .) It worked when I simply put the needed files in the same directory as the executable, as might be expected . . . I will test to see if it can be more general (file i/o spread across directories).
One open issue is that I was actually using a script as my "top" layer of Matlab code. It worked. The documentation indicates that the top layer of stand alone compiled Matlab should be a function . . . though I admit that I am fairly new to Matlab, and I am certainly new to compiling Matlab code.)
So, I added a function as the top layer, and put in an argument (a filename for some i/o - that contains filenames used in the sim), and things went well. This function calls a script that calls other scripts that call functions . . .
Regards, Tim

카테고리

Help CenterFile Exchange에서 MATLAB Compiler에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by