How to pass filepath to MATLAB executable
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Deepa Maheshvare M.
el 27 de Feb. de 2023
Comentada: Rik
el 28 de Feb. de 2023
Hi All,
I have created a executable using the application complier.
The function requires the input file path
function main(filepath)
I am not sure how to pass the file path as an input argument to the executable generated using the about funciton.
I tried
!main 'I:\project\task'
but this is not working.
Suggestions will be really helpful.
2 comentarios
Jan
el 27 de Feb. de 2023
"This is no working" is too lean to explain, what happens. Prefer to mention, what you observe. This helps to solve your problem.
Deepa Maheshvare M.
el 27 de Feb. de 2023
Editada: Deepa Maheshvare M.
el 27 de Feb. de 2023
Respuesta aceptada
Rik
el 27 de Feb. de 2023
Editada: Rik
el 27 de Feb. de 2023
You're using Matlab syntax to define a char vector, but that is something that will happen automatically.
You can experiment with this tester function:
function main(varargin)
for n=1:nargin
fprintf('input number %d has class %s and contains this:\n',n,class(varargin{n}))
disp(varargin{n})
fprintf('\n')
end
end
To avoid syntax error caused by DOS itself you should consider
!main "I:\project\task"
You can test the effect quickly by using ECHO so you get immediate feedback about any syntax issues.
Edit after your comment to Jan:
You probably want this:
[status,response]=dos(['main ' taskdir]);
That will send the char contained in taskdir as the argument to the function main.
4 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre MATLAB Compiler en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!