Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何避免在数组末尾删除零元素?例如我有一个矩阵(数组)[1,0,1,1,1,0]。当我在函数中找到这个数组作为返回值时,它需要返回我写的内容,但它返回 1 0 1 1 1。如何避免那种自动删除零元素的情况?
以下示例有效。
function [array] = returnCompleteArray() array = [1,0,1,1,1,0]; endfunction a = returnCompleteArray(); disp(a);
您如何在函数中分配数组?你能提供你的代码吗?