Get array possition from mat file
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
Hi,
I have an struct file of 30584*8 fields. How can i get the array position like xaddress and y address from the structure.
댓글 수: 4
Mohammad Sami
2020년 9월 8일
I see the data you have uploaded is not a struct but an array of size 30584 x 8
If you know which cols are x and y address, you can simple get it by indexing with column no.
col1 = C(:,1);
KSSV
2020년 9월 8일
S = load("final.mat") ;
data = S.C ;
data is a double matrix of size 30584*8. What you want?
Stephen23
2020년 9월 8일
"I see the data you have uploaded is not a struct but an array of size 30584 x 8"
Structures can also be arrays of any size, the mat file contains a numeric array.
amitk matlab
2020년 9월 8일
답변 (1개)
KSSV
2020년 9월 8일
load("final.mat")
val = 6 ; % the value which you seek
idx = find(C==val) ; % gives global indices
[r,c] = ind2sub(size(C),idx) ; % gives sub-indices i.e row and column
댓글 수: 1
amitk matlab
2020년 9월 8일
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!