How to create a variable where certain subjects are coded as 1?
显示 更早的评论
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!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!