我总是假设使用for循环迭代空向量与完全没有循环相同.但是,我偶然发现了这种奇怪的行为:
for t = [] %// Iterate an empty 0x0 matrix
1
end
for t = ones(1, 0) %// Iterate an empty 1x0 matrix
2
end
for t = ones(0, 1) %// Iterate an empty 0x1 matrix
3
end
Run Code Online (Sandbox Code Playgroud)
结果是:
ans =
3
Run Code Online (Sandbox Code Playgroud)
它是否有意义,或者这是一个错误?