Limit a vector value
10 ビュー (過去 30 日間)
古いコメントを表示
Hello!
I need help in limiting a variable vector (V) to lower limit (L) and upper limit (U) vectors, i.e. the value of the first variable in V is between L(1) and U(1). How I can do that?
Thanks in advance !
採用された回答
Fangjun Jiang
2020 年 8 月 8 日
>> min([1 2 3],[2 0 5])
ans =
1 0 3
also see max()
3 件のコメント
Fangjun Jiang
2020 年 8 月 8 日
編集済み: Fangjun Jiang
2020 年 8 月 8 日
%%
L=[1 2 3];
U=[10 20 30];
V=[5 0 50];
NewV=min(max(L,V),U)
NewV =
5 2 30
Make sure there is no conflict between L and U
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!