Effacer les filtres
Effacer les filtres

how can i input variable in function?

4 vues (au cours des 30 derniers jours)
arian hoseini
arian hoseini le 5 Jan 2022
linedata = [ 1 0 0.000 0.200
2 0 0.000 0.150
3 0 0.000 0.250
1 4 0.035 0.225
1 5 0.025 0.105
1 6 0.040 0.215
2 4 0.000 0.035
3 5 0.000 0.042
4 6 0.028 0.125
5 6 0.026 0.175];
function [Zbus] = zbuild(linedata)
nl = linedata(:,1); nr = linedata(:,2); R = linedata(:,3);
X = linedata(:,4);

Réponse acceptée

Voss
Voss le 5 Jan 2022
% define your input argument:
linedata = [ 1 0 0.000 0.200
2 0 0.000 0.150
3 0 0.000 0.250
1 4 0.035 0.225
1 5 0.025 0.105
1 6 0.040 0.215
2 4 0.000 0.035
3 5 0.000 0.042
4 6 0.028 0.125
5 6 0.026 0.175];
% call the function with the input argument:
zbuild(linedata)
ans = 0
function [Zbus] = zbuild(linedata)
nl = linedata(:,1); nr = linedata(:,2); R = linedata(:,3);
X = linedata(:,4);
Zbus = 0; % define the output argument to return
end

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Tags

Produits


Version

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by