How to turn a Yes/No cell array into binary (0-1)

3 views (last 30 days)
I have a Yes/No cell array of 4000x1 and want to turn it into a binary system
Thanks for your attention

Answers (2)

Jon
Jon on 5 Jul 2022
A = {true,false;false,true}
A = 2×2 cell array
{[1]} {[0]} {[0]} {[1]}
B = cell2mat(A)
B = 2×2 logical array
1 0 0 1
  5 Comments
Jon
Jon on 6 Jul 2022
Did this solve your problem? If so please accept the answer so others will know that a solution is available

Sign in to comment.


ajay kumar
ajay kumar on 6 Jul 2022
m = {true,false;false,true};
for i = 1:numel(m)
disp(m(i))
end
{[1]} {[0]} {[0]} {[1]}

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by