I currently have a vector containing a cell array of predefined values. The number and content of these values should be able to vary:
names = {'r1','r2','r3'};
Furthermore, I have a Matrix, that should serve as an index Matrix. It looks like the following example, however, should also be variable in its size.
mat = [1 3 3; 2 1 3; 1 1 1];
Delivering:
1 3 3
2 1 3
1 1 1
I would now like to create a matrix containing the respective values of the array in the same matrix format. Hence, whereever mat contains a 1 the output should contain the first value of names and so on. The final result should then look like:
r1 r3 r3
r2 r1 r3
r1 r1 r1
Just to avoid missunderstandings: The content of names simply serves as an example here. Later specific names should be matched and it cannot be solved by simply adding an r infront of every index value.
Many thanks for your help!