I have no idea what you are trying to do and why you would need a function returning two identical matrices.
The for loop in you local function U_ does not make any sense as the actual arguments of that function when you call it are just scalars (either 0 or 1).
Your function will return two identical matrices unless the first and/or last values in the argument vector are 0' or 1's because the loop for O runs from 0 to 1. Thats the reason for the different result in your third example.
As already said - I don't know what you are trying to do. I do not even know whether the green or the red result is what you expect and need. In you first question you demanded exactly that red result and now you are wondering why the two rows are different!?
EDIT: Just an afterthought: If the input matrix is [ 3 3 3 0 0 3 3 3 3 7 7 1 1 3 3 3 5 5], what do you expect as a result?
Are you expecting three different row vectors this time?
Perhaps [3 0 7 1 5], [0 3 7 1 5] and [0 7 1 3 5]?
If thats what you are after, what is the result for [ 0 0 0 1 1 3 3 0 0 1 1 1 2 0 0 0]?
Six rows?
[0 1 3 2]
[1 3 0 2]
[1 3 2 0]
[0 3 1 2]
[3 0 1 2]
[3 1 2 0]
Welcome to the PTC Community
No account yet? Create an account
Please use your PTC eSupport account.
LoginEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.

