How to call one of the outputs of the function?

45 Ansichten (letzte 30 Tage)
Ali Deniz
Ali Deniz am 24 Okt. 2022
Bearbeitet: Fangjun Jiang am 24 Okt. 2022
I have a function below. I have three outputs in this function which are "phi_ave_x, phi_ave_y, phi_ave_z", as seen below. How can call one of this outputs from this function in another code file. Thank you.
function [phi_ave_x, phi_ave_y, phi_ave_z] = crk4_aee321_Lorentz(xi,yi,zi,dt)

Antworten (2)

Fangjun Jiang
Fangjun Jiang am 24 Okt. 2022
Bearbeitet: Fangjun Jiang am 24 Okt. 2022
phi_ave_x = crk4_aee321_Lorentz(xi,yi,zi,dt)
[phi_ave_x, phi_ave_y] = crk4_aee321_Lorentz(xi,yi,zi,dt)
[phi_ave_x, phi_ave_y, phi_ave_z] = crk4_aee321_Lorentz(xi,yi,zi,dt)
[~, phi_ave_y, phi_ave_z] = crk4_aee321_Lorentz(xi,yi,zi,dt)
[~, ~, phi_ave_z] = crk4_aee321_Lorentz(xi,yi,zi,dt)

Jan
Jan am 24 Okt. 2022
[phi_ave_x, phi_ave_y, phi_ave_z] = crk4_aee321_Lorentz(xi,yi,zi,dt);
disp(phi_ave_y)
This uses the 2nd output phi_ave_y as input for the disp() command.

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by