Given a vector U n x 1 which contains the entries from 0,1,2,3 , I would like to create another vector V in char type such that the entry
0 in U will be ‘0’ in V
1 in U will be ‘1’ in V
2 in U will be ’12’ in V
3 in U will be ‘123’ in V
What is the optimal way to do in matlab rather scanning each individual entry in the vector and then uses switch case?
You can easily define a set of rules and index into it.
In the above,
Ais the vector you have.