How to perform an find operation for multidimensional array in Simulink
3 views (last 30 days)
Show older comments
Hello everyone, I am working with multidimensional lookup tables and I am a bit stuck with an equivalent of find function in MATLAB. I need the index k and I can feed this index to my multidimensional lookup tables to load the kth lookup table and kth breakpoint. However to find the kth index, I need to compare two signal values with an array of variables. for example if the signal goes
*signal = [1 1 1 1 1 2 2 2 3],*
I need to compare it with a constant matrix which goes
*mymat = [ 1 1 2 3;
2 3 3 4].*
The signal is time dependant naturally, and the matrix is constant. the matrix records certain changes in values like 1to2, 2-3, 1-3, 3-4, 3-2,2-1 etc.
So basically I need to see where my signal changes from 1 to 2 and then I need to compare it with the matrix and see where I have the values [1;2]. ( should be index 1). The problem is two fold.
first I do not know how I can load the constant matrix in simulink. the from workspace option will not work and neither will the constant block option
Secondly, I tried using the prelookup table. I designated the two signal values as signal before and signal after ( using a memory block) and fed them individually to a pre look up table block. However here the breakpoint should be monotonically increasing and as it is seen, the individual rows of variables are not monotonically increasing.
I am struggling with this problem for a while now and would appreciate any suggestion. Is there any workaround solution to this issue?
0 Comments
Answers (0)
See Also
Categories
Find more on Simulink Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!