can any one tell me the exact working of the following statement.....here what is the exact meaning of < tmp.pgm >tmp.key..?

조회 수: 3 (최근 30일)
command = [command ' < tmp.pgm >tmp.key'];

답변 (1개)

Walter Roberson
Walter Roberson 2013년 9월 3일
In that statement, ' < tmp.pgm >tmp.key' is just a string that is being added on to the end of the existing content of what is in "command". No different in meaning than if it had been
command = [command '23 skidoo & you too!'];
What you need to ask is what is done later with the string "command" and whether it makes a difference there
I would be fairly sure that you will find that the string "command" is being used as sys(command) or dos(command) or unix(command) . In all three cases, the content of the string "command" would be sent to a system command shell for interpretation there. The content then becomes important according to its meaning in the system command shell, outside of the control of MATLAB.
In all currently supported operating systems, the system command shells interpret that particular sequence of characters the same way; even though the command shells are different, they use the same meaning for '<' and '>'. In particular, the portion '< tmp.pgm' would be interpreted as meaning that the program being run should take its input from a file named "tmp.pgm". The portion ">tmp.key" would be interpreted to mean that the regular (non-error) output of the program being run should be sent to the file named "tmp.key"
In that context, the "<" and ">" are known as "I/O redirection". This is not a MATLAB term; it is a term from portions of the system outside MATLAB.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by