필터 지우기
필터 지우기

How to get matrix data from function ,anyone help me

조회 수: 1 (최근 30일)
PRED LIU
PRED LIU 2020년 5월 2일
댓글: Walter Roberson 2020년 5월 2일
Z=[ 1 3 4 ;5 3 1;3 3 3];
a=1;
Qa=example(a,Z);
ss=Qa(1)+Qa(2); %=====> I CAN'T get both matrix data a+Z and a*Z
%%
%%%my function building as such
function dBB=example(a,Z)
dBB(1)= Z+Z;
dBB(2)=Z+Z+Z+Z+Z;
%%%%%%

채택된 답변

James Tursa
James Tursa 2020년 5월 2일
편집: James Tursa 2020년 5월 2일
Not sure what the real question is. Maybe this does what you want?
function [apZ,atZ]=example(a,Z)
apZ = a + Z;
atZ = a * Z;
end
and you would call it like this
[x,y] = example(a,Z);
  댓글 수: 2
PRED LIU
PRED LIU 2020년 5월 2일
Thank you ,James
I wnat to perform the following operations in the main program
answer = sqar ( apZ.^2 +atZ.^2)
Walter Roberson
Walter Roberson 2020년 5월 2일
[apZ, atZ] = example(a,Z);
answer = sqrt(apZ.^2 + atZ.^2);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Communications Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by