Change a column of data in a variable from numeric to a string value
Show older comments
Hello,
I have a variable (Gc) containing a range of data but only 2 columns (177,2). I want to change all the numeric entries in the 2nd column to display the word 'Good' where the number '1' occurs. I have tried this code below - but get the error that follows:
Gc(Gc(:,2)== 1, 2 ) = 'Good' ;
error -- Subscripted assignment dimension mismatch.
I understand that this is saying the value 'Good' is bigger then the value '1' so it won't fit. I have also looked at using num2string to help solve this - but I cannot make sense of it.
Once again community - any help or ideas please?
Regards,
10B.
Accepted Answer
More Answers (0)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!