Trouble passing a vector as the input for a function
古いコメントを表示
I'm trying to take a vector as an input for a function and change all the negative values of the vector into 0's, then output the new vector.
function newX = valu(x)
for x
if (x<0)
x = x .* 2;
end
newX = x;
end
end
How would I tell Mathlab that X is a vector that will be assigned by the user (when calling the function)?
2 件のコメント
madhan ravi
2018 年 11 月 2 日
Please don’t close question which has answer.
Rena Berman
2018 年 11 月 7 日
(Answers Dev) Restored edit
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および 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!