3D arrays manipulation and use of if else statments
2 views (last 30 days)
Show older comments
Hello Everyone,
Here is the situation. There are three 3D arrays. S (1x5x1000) that stores elements from 1:5, P (1x5x1000) that stores pairs for S, and idx (1x5x1000) to invoke pair. For example S is always the same and (1x5x1)=1 2 3 4 5, p (1x5x1)=3 1 5 2 3 and idx (1x5x1)=1 0 1 1 1. We have the situation where are two same (5-3 and 3-5) pairs with invoke signal, we need to change invoke signal from 1 to 0 that would look like 1 0 0 1 1, and we need to do this for the whole 3D array. Is there a way to achieve this without for loop, because this part is time sensitive? Simplified code
if idx(i)==1
if p(i)=s(p(i))
idx(i)=0
end
end
6 Comments
Answers (0)
See Also
Categories
Find more on Matrices and Arrays 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!