How I can run two different functions at the same time ?
36 ビュー (過去 30 日間)
古いコメントを表示
function [ add, sub] = inp(x,y)
add= x+ y;
sub=x-y;
end
function [ mul,div ] =iput(x,y)
mul=x*y;
div=x/y;
end
These two functions are in differnt script .I am running them differntly .But I want to do it in a single time because in both case my inputs are same .So how I can do it ?
0 件のコメント
採用された回答
Star Strider
2021 年 8 月 19 日
I am not certain what you want, however one approach is to write a third function that returns all the outputs of the other functions:
x = randi(9)
y = randi(9)
[A,B,C,D] = CallFcns(x,y)
function [A,B,C,D] = CallFcns(x,y)
[A,B] = inp(x,y);
[C,D] = iput(x,y);
end
function [ add, sub] = inp(x,y)
add= x+ y;
sub=x-y;
end
function [ mul,div ] =iput(x,y)
mul=x*y;
div=x/y;
end
.
0 件のコメント
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!