So let's say I have a NXN cell each entry in the cell is int itself a cell.For example
B is a 23x23 cell and B{1,1} is a 2x2 cell that stores the x and y coordinates for the pixel shown in the image
The first grid on the top left 's pixel coordinates are represented by B{1,1}.
I would like to know how can I access the entries properly.
I have enclosed 2 mat files one is the B cell,the other is X0 which is an entry inside B(1,1).
X0 is a 2x2 cell where each entry tells us the X and Y coordinates of the pixel.So X0 (1,1) is 1,1 which is the location of pixel 255 in the original image.
Any tips will be appreciated.
PS using matlab after pretty long time,so that's why the questions

 채택된 답변

Matt J
Matt J 2021년 8월 2일
편집: Matt J 2021년 8월 2일

0 개 추천

I have enclosed 2 mat files
I see no attachments, so you probably forgot to click 'Submit'. In any case, your data organization sounds worrisomely awkward. It is usually a good idea to use cell arrays only for things that vary in size. Nevertheless, you can access nested cells using successions of brace indexing operations, e.g.,
B{1,1}{1,2}

댓글 수: 5

Sparsh Garg
Sparsh Garg 2021년 8월 2일
Hi Matt,I have included the attachments.Would it help if I save B as a struct
Matt J
Matt J 2021년 8월 2일
편집: Matt J 2021년 8월 2일
Help with what? There doesn't seem to be a problem any more, now that I've told you how to index into nested cells.
Sparsh Garg
Sparsh Garg 2021년 8월 2일
oh ok
Matt J
Matt J 2021년 8월 2일
So then, if you agree that your question is answered, please do Accept-click it.
Sparsh Garg
Sparsh Garg 2021년 8월 3일
done

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

질문:

2021년 8월 2일

댓글:

2021년 8월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by