フィルターのクリア

how to give variable inputs in coding

2 ビュー (過去 30 日間)
Ambika
Ambika 2012 年 1 月 19 日
suppose i want to give an input x= 5 in the range varying from 0 to 10 and another input y=4.1 in the same range. my output is z.
so how can i define the input and output using 'function'.
for eg:
function z= data(x,y)
the x and y should be given externally or is not included in the coding
thanks for helping in advance

採用された回答

Venn Ravichandran
Venn Ravichandran 2012 年 1 月 19 日
Ambika,
I'm not sure I follow your question. Are you asking how to limit the range of the inputs or how to define a function that accepts x and y as two inputs?
If you want to limit the range, you will have to do it yourself inside the function to check that both x and y are within the range, and if not, throw an error.
If you just wanted to define the function, what you have should work. Although I would name the function something more intuitive (and relevant to what the function does, for instance addition) other than "data".
Cheers, -Venn
  1 件のコメント
Ambika
Ambika 2012 年 1 月 19 日
actually i want to give variable inputs means , if am giving x=1 and y= 3 for first time, next time i wil give x=2.4 and y= 3.5 and so on... do i have to give these inputs in command window? how i have to give these inpts?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFunctions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by