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
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
KSSV 2020 年 9 月 8 日
S = load("final.mat") ;
data = S.C ;
data is a double matrix of size 30584*8. What you want?
Stephen23
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
amitk matlab 2020 年 9 月 8 日
I want the position. Suppose if i click on the value 6 (which is first row 3rd column) it gives xaddress 1 yaddress 3.

回答 (1 件)

KSSV
KSSV 2020 年 9 月 8 日

0 投票

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
amitk matlab 2020 年 9 月 8 日
Sorry, I cannot describe you properly. i need the location information in another array of the whole table. If i click on a particular filed value like 6, it gives its corresponding x position and y position.

この質問は閉じられています。

タグ

質問済み:

2020 年 9 月 8 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by