Info

この質問は閉じられています。 編集または回答するには再度開いてください。

one scalar from two vectore

4 ビュー (過去 30 日間)
Emily Baldi
Emily Baldi 2015 年 1 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have two vectors. one speed (v1 v2 v3) and one that identifies the car on (a1 a2 a3). Only one car is running. which block I have to use to get the single speed? the bits of two cars are zero and the bits of a car is 1.

回答 (2 件)

dpb
dpb 2015 年 1 月 22 日
If a is a numeric array of bits,
V=v(logical(a));
Alternatively, keep a as logical array to avoid the cast or if it must be numerical it's also
V=v(find(a));
but logical will be faster than find I'd expect.
  1 件のコメント
dpb
dpb 2015 年 1 月 22 日
I "know nuthink!" about Simulink, sorry...

Emily Baldi
Emily Baldi 2015 年 1 月 22 日
thanks dpb. but I'm using simulink, not matlab. Do you know also a simulink method about mu problem?

この質問は閉じられています。

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by