How to create a variable where certain subjects are coded as 1?
Ältere Kommentare anzeigen
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!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!