Skip to content

Instantly share code, notes, and snippets.

@morganp
Created July 15, 2015 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morganp/6c26f4ab3d8ddbe7dc69 to your computer and use it in GitHub Desktop.
Save morganp/6c26f4ab3d8ddbe7dc69 to your computer and use it in GitHub Desktop.
Display with auto concationation and numeric converion to strings
function disp2( varargin )
%DISP2 Similar to disp but ...
% But no requirment for [] string concatination,
% Numerics automatically converted to strings.
str = '';
for i=1:length(varargin)
element = varargin(i); element = element{:};
if isnumeric(element)
str = [str, num2str( element ), ' '];
else
str = [str, element, ' '];
end
end
disp(str)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment