Split vector into array with different ranges
3 ビュー (過去 30 日間)
古いコメントを表示
Hey Guys! I am new to MATLAB and I could not solve this question. There is a lot of ways to do it but these are the this that I did not learn at all. Write a function that splits the elements of a vector into three arrays with different ranges: [0-10), [10-100) and [100,1000]. For instance, a=[ 22 9 65 814 165 3 ] wil become x=[9 3], y=[22 65] and z=[814 165].
0 件のコメント
回答 (1 件)
Dyuman Joshi
2021 年 5 月 12 日
編集済み: Dyuman Joshi
2021 年 5 月 12 日
a=[22 9 65 814 165 3];
x=a(a<10);
y=a(a>=10&a<100);
z=a(a>=100);
This is assuming that the numbers in x are in the range [0-1000]. For any other range, edit accordingly.
6 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!