how to print variables in command window with message

6 次查看(过去 30 天)
A=[1, 3,4]
I want to print size of A is length(A) and A is print(A , length(A))

采纳的回答

Walter Roberson
Walter Roberson 2015-12-13
I had to make some guesses about exactly what you want output.
varname = 'A';
varlength = length(A);
fprintf('size of %s is %d\n', varname, varlength);
fprintf('%s is', varname);
fprintf(' %g', [A(:); varlength]);
fprintf('\n');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by