MATLAB Answers

How can i remove data points from an array in simulink ?

5 ビュー (過去 30 日間)
Jasmeet Ladoiye
Jasmeet Ladoiye 2020 年 6 月 2 日
コメント済み: Jasmeet Ladoiye 2020 年 6 月 4 日
I am developing a code where i want to remove all data that is repeating consecutively in simulink workspace. I am using a buffer of size 15 ( to illustrate ) and i want get rid of the all the repeating consective value in a buffer. The truncated array is then resampled to add new data points to it.
e.g. A = [ 1 1 1 1 1 2 2 2 2 3 4 5 6 6 7];
truncated Output: [1 2 3 4 5 6 7]
resampled Output: [1 1.2 1.4 1.6 1.8 2 2.25 2.5 2.75 3 4 5 6 6.5 7];
Requirements: It should be in simulink. I was considering using lookup table for resampling but i it need variables to initialize, i dont think it can resample online.
Can anyone suggest how can we solve this problem ?

  0 件のコメント

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

回答 (1 件)

Jonas
Jonas 2020 年 6 月 4 日
編集済み: Jonas 2020 年 6 月 4 日
If you have the code to perform it in MATLAB, you can use an embedded matlab function.
Stateflow also seems like a good candidate since the solution will involve for/while loops and Stateflow is perfectly fitted to perform these.
Using only Simulink blocks is going to be difficult I think.

  1 件のコメント

Jasmeet Ladoiye
Jasmeet Ladoiye 2020 年 6 月 4 日
I tried the embedded matlab function but i am able to remove the data sets in the function as the size of the vector changes. It generates an error due to the variable size of the vector.
Stateflow: Maybe i have not tried yet. I will try it out.

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

Community Treasure Hunt

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

Start Hunting!

Translated by