how can i input variable in function?

1 回表示 (過去 30 日間)
arian hoseini
arian hoseini 2022 年 1 月 5 日
編集済み: Walter Roberson 2022 年 1 月 5 日
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);

採用された回答

Voss
Voss 2022 年 1 月 5 日
% 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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by