error using system -- "Command argument must be either a nonmissing scalar string or a character row vector. "
Afficher commentaires plus anciens
I donwloaded open source code that enables me to run Qspice from the command line and directly use its data in the MATLAB script. However, I get an error in the this section that I cannot understand:"Command argument must be either a nonmissing scalar string or a character row vector."
c = cmdsep; //this works in my version of MATLAB (2023b).
cmd_str = [
'path ',QspicePath,...
c,...
'QUX -Netlist "',Qpath.qsch,'"'
];
[status,Qpath.cir] = system(cmd_str)
it seems the syntax of the assembled path/file to run is incorrect, but I don't know what it needs to be.
The assembled cmd_str is:
cmd_str =
1×6 string array
"path " "C:\Program Files\QSPICE\" "&&" "QUX -Netlist "" "C:\Users\jorge.rive\OneDri…" """
The error I get when
system(cmd_str)
runs is:
Error using system
Command argument must be either a nonmissing scalar string or a character row vector.
Thank you in advance for the help.
Jorge
3 commentaires
Gah, CMDSEP returns a string scalar:
cmdsep
Thanks TMW for more inconsistencies to deal with:
filesep
I guess we can expect future duplicate threads on this topic.
Jorge
le 10 Jan 2024
Dyuman Joshi
le 10 Jan 2024
They both represent text data format, albeit are different data types.
For more information, see - https://in.mathworks.com/help/matlab/matlab_prog/represent-text-with-character-and-string-arrays.html
Réponse acceptée
Plus de réponses (1)
Hassaan
le 10 Jan 2024
c = cmdsep; % This works in MATLAB 2023b
QspicePath = 'C:\Program Files\QSPICE\'; % Example path, replace with actual
Qpath.qsch = 'C:\Path\To\Your\Netlist.qsch'; % Replace with your actual netlist file path
% Construct the command string
cmd_str = strjoin([
'path ', QspicePath,
c,
'QUX -Netlist "', Qpath.qsch, '"'
], '');
% Execute the command
[status, Qpath.cir] = system(cmd_str);
% Check status and output
disp(status);
disp(Qpath.cir);
- strjoin is used with an empty delimiter '' to concatenate all the parts of the command into a single string.
- Ensure that QspicePath and Qpath.qsch contain the correct paths for your QSPICE installation and netlist file, respectively.
- The system command is then executed with cmd_str as a single concatenated string.
This should resolve the error and allow the command to be executed properly. However, make sure that the paths and command syntax are correct for your specific QSPICE setup and environment.
---------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Feel free to contact me.
Catégories
En savoir plus sur Test and Measurement dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!