0

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

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

5 Comments

i tried ''C:\Program Files\CloudCompare\CloudCompare -o C:\CloudComparetest\test.bin''' but no sucess'''. It didn't work.
Is it the correct path? To test, you could put the command in a bat-file, followed by pause, call the bat from matlab, then you could see the error message from cmd
i don't understand bat-file concept. I think problem is space. I donot know how to finish it.
When I look at your examples that work, you use different commands (dos and system), but they should both do the same. The second example is clearly wrong, > is a redirect character, not te be used in a path. Your command window example does not include the -SS switch?
You still should use "" around the path+command, as shown in my edited cloud.bat example. The error you get means that the command interpreter thinks c:\program is a command. It breaks because of the space in program files. "" tells the command interpreter to use the complete string as the command

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.