how to add the input filenames correctly for a .exe in matlab?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, anyone can help? I made a .exe file for my matlab functions using the MATLAB COMPILER. While when I use "system" command to run this .exe with inputs specified, I got an error saying the file cannot be read:

Error at line 19 has code like this:
Rrs412=double(hdf5read(fname_oc,'/bands/Rrs_412')).*slope_oc+intercept_oc;
fname_oc is my input file with command:
[status, result] = system(['cal_sss_sat_gom.exe fname_sst fname_oc']);
I am pretty sure the file path and file name are correct, when I type command the following command separately under the command line:
Rrs412=double(hdf5read(fname_oc,'/bands/Rrs_412')).*slope_oc+intercept_oc;
it works perfect.
Below is some code of my function:
==================================================
function SSS = sss_MODIS_NN(fname_sst,fname_oc) slope_oc=1; intercept_oc=0; slope_sst=1; intercept_sst=0; Rrs412=double(hdf5read(fname_oc,'/bands/Rrs_412')).*slope_oc+intercept_oc; Rrs443=double(hdf5read(fname_oc,'/bands/Rrs_443')).*slope_oc+intercept_oc; Rrs488=double(hdf5read(fname_oc,'/bands/Rrs_488')).*slope_oc+intercept_oc; Rrs555=double(hdf5read(fname_oc,'/bands/Rrs_555_ocean')).*slope_oc+intercept_oc; Rrs667=double(hdf5read(fname_oc,'/bands/Rrs_667')).*slope_oc+intercept_oc; sst=double(hdf5read(fname_sst,'/bands/sst')).*slope_sst+intercept_sst;
...
===============================================================
Anyone can help me? I have been struggling on this for a few days... Thank you very much!
Best,
Cathy
0 commentaires
Réponses (1)
Walter Roberson
le 1 Fév 2017
When you build an executable with MATLAB Compiler, it starts running with a current directory that is the place the executable was installed.
5 commentaires
Walter Roberson
le 1 Fév 2017
The second output of system() is the text that would have gone to the command window. If you are calculating something numeric and not displaying it then system() is not going to be able to return it.
MATLAB Compiler SDK would be more natural for your problem, if what you want is something that can be called from MATLAB to return a numeric variable.
Voir également
Catégories
En savoir plus sur MATLAB Compiler SDK dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!