Shahgee
Shahgee

Reputation: 3405

running command line using matlab

I want to run the following command line

'C:\Program Files\CloudCompare>CloudCompare -o C:\CloudComparetest\test.bin -SS SPATIAL 0.1'

It works well ( see image) when I follow this way:

window-->cmd and type it directly there.

But I need to run this command inside matlab job. Online search gives me this pattern to run simple commands:

It works:

     command = 'C:\Program Files\CloudCompare\CloudCompare.exe';
     [status,cmdout] = system(command)
status=0;

But trying this gives me errors: (I know it is not standard dos command...may be any other solution.

    %  command = 'C:\Program Files\CloudCompare>CloudCompare -o C:\CloudComparetest\test.bin -SS SPATIAL 0.1';
    %  status = dos(command)
status=1;

I also tried

%  command = 'C:\Program Files\CloudCompare\CloudCompare -o C:\CloudComparetest\test.bin -SS SPATIAL 0.1';
%  status = dos(command)

status=1;

image

Error: while running cloud.bat

Either the command is not correct or can not be found.

 dos('"C:\MyPHDCODE\COLOR_SCANS\cloud.bat"')
C:\MyPHDCODE\Chapter5\COLORIMAGES>C:\Program Files\CloudCompare\CloudCompare -o C:\CloudComparetest\test.bin -SS SPATIAL 0.1 pause  
Der Befehl "C:\Program" ist entweder falsch geschrieben oder 
konnte nicht gefunden werden. 

ans =

     1

image

Upvotes: 0

Views: 400

Answers (1)

Stefan
Stefan

Reputation: 632

Note you have a space in your path name, and a >. Replace > with \ and enclose the command in "", this will let cmd run the command correctly (if there are no other errors)

Put this in a text file called cloud.bat:
"C:\Program Files\CloudCompare\CloudCompare" -o C:\CloudComparetest\test.bin -SS SPATIAL 0.1 pause

(SPATIAL 0.1 should be on the same line as the rest, pause on a new line)

Then call cloud.bat from the dos command. You should place cloud.bat in your current MatLab directory.

EDIT: what I meant here is that you should call cloud.bat from MatLab, I can see that it can be misunderstood.

When this is run you can see any error messages from CloudCompare.

Upvotes: 2

Related Questions