How can you display a null/empty matrix?

4 次查看(过去 30 天)
is this a way? M = [ ] disp(M)

回答(1 个)

Benjamin Avants
Benjamin Avants 2014-3-14
Your method won't display anything. You can remove the semicolon from the line that assigns a value to M and it will display like this:
M = []
M =
[]
If you want to test if it is empty use something like the following:
M = [];
if isempty(M)
disp('M is empty')
end

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by