Unexpected MATLAB operator when trying to a run a script from the command line
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Maurice Volaski
le 19 Sep 2017
Réponse apportée : James Tursa
le 19 Sep 2017
I am running Matlab on the command line under Linux. When I pass to it
run(/gs/gsfs0/users/mvolaski/test.m)
I get
run(/gs/gsfs0/users/mvolaski/test.m) | Error: Unexpected MATLAB operator.
The code in the file is:
a=[2.3 3.422 -6.121 9 4.55];
fid = fopen('/gs/gsfs0/users/mvolaski/test.output','wt'); % Note the 'wt' for writing
in text mode
fprintf(fid,'%f\n',a); % The format string is applied to each element of a
fclose(fid);
Why?
0 commentaires
Réponse acceptée
James Tursa
le 19 Sep 2017
Make the input a character string by using quotes:
run('/gs/gsfs0/users/mvolaski/test.m')
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Entering Commands 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!