필터 지우기
필터 지우기

Matrix output from a function to workspace

조회 수: 4 (최근 30일)
Alexander Norton
Alexander Norton 2016년 3월 21일
답변: Dave Behera 2016년 3월 25일
I have a basic function that calculates 3 matrices. I want to, as part of the function, save them to my workspace. Im sure there used to be a simple way of doing that but i cant remember what that is.
cheers alex
  댓글 수: 1
KSSV
KSSV 2016년 3월 21일
As you said you have a function. Take the output of those matrices from function.

댓글을 달려면 로그인하십시오.

답변 (1개)

Dave Behera
Dave Behera 2016년 3월 25일
So, you have a function that computes three matrices. You can have it return 3 output arguments. You just need to modify the function definition to look like this:
function [mat1, mat2, mat3] = functionName()
%%%%your code to compute 3 matrices%%%
%%%assign the 3 matrices to mat1, mat2, mat3%%%
end
Call the function:
[mat1, mat2, mat3] = functionName()
In your workspace, the variables mat1, mat2, mat3 will now have the 3 matrices.

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by