How do I associate specific values to specific verbiage?

1 view (last 30 days)
I've got 2 arrays: A = [1; 2; 3; 1; 2; 3]; and B = [ ];
I need array B to contain [Lost; Found; Unk; Lost; Found; Unk] based on the values found in A.
I'm using the find function to locate the indices of the values 1, 2, and 3. But I'm not sure what to do next.
Any ideas are appreciated. Thanks.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 9 Oct 2013
A = [1; 2; 3; 1; 2; 3]
v={'Lost'; 'Found'; 'Unk'}
B=v(A)
  4 Comments
Brad
Brad on 9 Oct 2013
Sorry Azzi.
What if A = [1; 11; 3; 1; 2; 3; 55; 1; 53; 29] ?
How would I associate 'Lost', 'Found', 'Unk' with 1,2, and 3?

Sign in to comment.

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!