how can I make a matrix into structure

1 view (last 30 days)
cheng chia jung
cheng chia jung on 15 Aug 2022
Commented: Rik on 15 Aug 2022
Hi everyone,I have a problem of change the matrix into the structure.
i made the matrix about 6*29539,
pic_pp=85;
cam_num=257;
pindex=zeros(pic_pp^2*cam_num,6);
pindex(:,1)=reshape(X1,pic_pp^2*cam_num,1);%x方向投影點
pindex(:,2)=reshape(Y1,pic_pp^2*cam_num,1);%Y方向投影點
pindex(:,3)=reshape(pic_depths,pic_pp^2*cam_num,1);%深度資訊
pindex(:,4)=reshape(OP_offsetX,pic_pp^2*cam_num,1);%X方向偏移量
pindex(:,5)=reshape(OP_offsetY,pic_pp^2*cam_num,1);%Y方向偏移量
pindex(:,6)=reshape(pic_strenth,pic_pp^2*cam_num,1);%強度資訊
pindex(pindex(:,3)==0,:)=[];%刪除為零資訊
i want to let the first line to be the first structure,and the second line to be the second one,third line to be the third one.
the third structure whitch included the fourth to sixth line of matrix,.How can i built the structure likes this?
T=struct.x(3).y(4).z(4)
ans=[2104 3 24
2315 3 146
1464 3 64
...
]
  1 Comment
Rik
Rik on 15 Aug 2022
So you want a struct array? Why don't you make that then? It works the same as any other array.
I also don't understand what your last lines of code are meant to do.

Sign in to comment.

Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!