function that outputs a matrix with matrix elements referenced explicitly
2 次查看(过去 30 天)
显示 更早的评论
I can write a function that outputs a matrix
function f = func(arg)
...
f = [res1, res2, res3]
end
I can store the result of the function func in the following way
p = func(arg)
where p is a 1x3 matrix.
But I would like to explicitly reference the matrix elements, e.g.
[temp, elevation, sec] = func(arg)
An analogous example is the size function:
[nrow, ncol] = size(matrix)
What modifications to the function func are necessary?
0 个评论
采纳的回答
Rik
2017-10-17
function [temp, elevation, sec] = func(arg)
...
end
You may also want to have a look at varargin, varargout, nargin and nargout.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Argument Definitions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!