سؤال

Please i need help but it's a little hard for me to declare it correctly in English,please be patient with me. I've got a cell array which for example has 10 rows and 10 columns. I fill each rows of the cell array in a loop(for) and there is this Probability that a row of it wont get any value then the result is e.g there would be rows 2 and 4 but there would n't be any third row:

t{2,1},...,t{2,10} exits
t{4,1},...,t{4,10} exists
but there is no t{3,1},.....,t{3,10}

Now i want to check if the third row exists or not? I tried:

if t{3,1}

but it did not worked and there is not any codes like:

if exists(t{3,1})

what should i do?

هل كانت مفيدة؟

المحلول

t{3,1} does exist, it's just empty. Therefore what you need is something along the lines of:

if ~isempty(t{3,1})

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top