フィルターのクリア

Create an "equispaced" vector that includes a number of given points

6 ビュー (過去 30 日間)
Alejandro Fernández
Alejandro Fernández 2021 年 4 月 22 日
Hi, I was wondering how I could make a vector that I have obtained with linspace for example of the style:
v = linspace(0,7,8)
So v = [0 1 2 3 4 5 6 7]
And given another vector in the variable a such as could be:
a = [1 1.5 4 6.2]
Introduce the elements that are not in the vector v in the position so that the result is increasing.
So the result should be:
result = [0 1 1.5 2 3 4 5 6 6.2 7]
  3 件のコメント
Scott MacKenzie
Scott MacKenzie 2021 年 4 月 22 日
I think we answered at the same time. If I understand correctly, the second argument ('first') is only needed if the indices are also needed.
Alejandro Fernández
Alejandro Fernández 2021 年 4 月 22 日
Yes sorry, I forgot to write that line of code when I was typing the first time. But don't worry, it's perfect.

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

採用された回答

Scott MacKenzie
Scott MacKenzie 2021 年 4 月 22 日
編集済み: Scott MacKenzie 2021 年 4 月 22 日
result = unique([v a])

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by