printOrange Print orange-colored stringToPrint to the MATLAB Command Window. Only if MATLAB is open with GUI, does not work with command-line MATLAB. Input: stringToPrint string that should be printed in orange color Usage: printOrange(stringToPrint)
0001 function orangeString = printOrange(stringToPrint) 0002 % printOrange 0003 % Print orange-colored stringToPrint to the MATLAB Command Window. Only 0004 % if MATLAB is open with GUI, does not work with command-line MATLAB. 0005 % 0006 % Input: 0007 % stringToPrint string that should be printed in orange color 0008 % 0009 % Usage: printOrange(stringToPrint) 0010 0011 try useDesktop = usejava('desktop'); catch, useDesktop = false; end 0012 if useDesktop 0013 orangeString = ['[\b' stringToPrint,']\b']; 0014 else 0015 orangeString = stringToPrint; 0016 end 0017 if nargout < 1 0018 % Wrap text to command window size 0019 sz = get(0, 'CommandWindowSize'); 0020 orangeString = textwrap({orangeString},sz(1)); 0021 orangeString = strjoin(orangeString,'\n'); 0022 fprintf(orangeString); 0023 end 0024 end