How to create a variable where certain subjects are coded as 1?
Show older comments
Hi all.
A Matlab beginner here, would appreciate some advice.
I want to create a variable called 'flag_artifact' where certain subjects from my dataset (for whom I know have bad quality images) are coded as e.g., 1. My dataset is stored in a table T with a certain number of rows and 'subject' is the 1st column in the table.
I managed to do it by creating a for loop. Here is what I have:
flag_artifact = {'T_300'};
for i = 1:size(T,1)
if isequal(table2cell(T1(i, 1)), flag_artifact)
T(i, 1) = {'1'};
end
end
Surely there is a more efficient way to do this by perhaps directly creating the variable and using less lines of code? Could anyone give some advice?
Thank you very much!
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!