Can I run a matlab file with symbolic functions from the command line?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Antonio Scala
il 10 Dic 2019
Risposto: Ridwan Alam
il 10 Dic 2019
I am trying to run this file below with symbolic expresssions. It runs in the editor and it does output to the two files below with no errors.
A = [1 1 1 1 1 2 2; 1 3 2 6 4 2 6; 1 2 4 1 2 5 3; 1 6 1 6 1 5 2; 1 4 2 1 4 5 6; 1 5 4 6 2 4 6];
sym x_1;
sym x_2;
sym x_3;
sym x_4;
sym x_5;
sym x_6;
Q = [x_1 x_2 x_3 x_4 x_5 x_6 1];
solution = solve(A*Q.');
answer = [solution.x_1 solution.x_2 solution.x_3 solution.x_4 solution.x_5 solution.x_6 1];
answer = mod(answer, 7);
answer = answer*10;
answer = mod(answer, 7);
answer = double(answer);
check = mod(A*answer.',7);
check = double(check);
writematrix(answer, "test2.txt");
writematrix(check, "check.txt");
But when I try to run it from the command line using:
matlab -nodisplay -nosplash -nodesktop -r "run('C:\pathtofile\file.m');"
It returns an error saying that the variable x_1 does not exist. Does that mean symbolc expressions cannot work from the command line?
0 Commenti
Risposta accettata
Ridwan Alam
il 10 Dic 2019
syms x_1;
syms x_2;
syms x_3;
syms x_4;
syms x_5;
syms x_6;
Hope this helps!
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Assumptions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!