how can i input variable in function?

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by