フィルターのクリア

Error in using an element in a matrix as function input

2 ビュー (過去 30 日間)
Matty
Matty 2022 年 10 月 22 日
回答済み: Rik 2022 年 10 月 22 日
I have an array/vector c, and I want to use it as input for my function, Viscosity like this:
function fv=Viscosity(c(1), c(2), c(3), c(4), c(5), c(21),c(24))
However, I am receiving this error:
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

採用された回答

Rik
Rik 2022 年 10 月 22 日
You need to pass the entire array, or treat each element as a separate variable. You can of course create the c array inside your own function.
Functions in Matlab are intended to not care about anything in the calling workspace, just the input arguments and output arguments.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by