Liz Salander
Liz Salander

Reputation: 321

Octave print to cmd prompt

Using the Octave GUI, we can easily print to the console, for instance via:

disp('Print this');

However, what if I want to print to a console outside of the Octave GUI console? I know I can run Octave without the GUI, but I'm not interested in that. I want to use Octave running through the GUI to open up a new console (like in Windows via cmd) and print to that console.

Upvotes: 1

Views: 177

Answers (1)

rahnema1
rahnema1

Reputation: 15837

Define the function dispcmd and call it instead of disp.

function dispcmd(in)
    fid = fopen('temp-disp', 'w+t');
    fdisp(fid, in);
    fclose(fid);
    system('start cmd /Q/C "type temp-disp && pause>nul"');
end

Upvotes: 2

Related Questions