How to get matrix data from function ,anyone help me
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
PRED LIU
il 2 Mag 2020
Commentato: Walter Roberson
il 2 Mag 2020
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;
%%%%%%
0 Commenti
Risposta accettata
James Tursa
il 2 Mag 2020
Modificato: James Tursa
il 2 Mag 2020
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);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!