load mat table to gui table
古いコメントを表示
hello, i need to load specific data from my mat file to gui table u can see mat file in the picture https://www.mathworks.com/matlabcentral/answers/uploaded_files/85736/image.png i need to show specific data,
load Data_Plat.mat
[row,~] = size(Database_All);
data2 = cell(row,4);
for n = 1:row
data2{n,1} = Database_All.Plat{n};
data2{n,2} = Database_All.Nama{n};
data2{n,3} = Database_All.Jurusan{n};
data2{n,4} = Database_All.Status{n};
end
set(handles.uitable1,'Data',data2);
this is my code for show all data from mat file in to gui table, the question is, how can i just show 1 data, for example, data with number plat DD6713MT
採用された回答
その他の回答 (1 件)
Ilham Hardy
2017 年 8 月 17 日
If you are asking how to get the value of row 1 column 2 of your data2 cell, try
no_plat = data2{1,2}; % get row 1 column 2 value of data2
7 件のコメント
Yusran Said
2017 年 8 月 17 日
Ilham Hardy
2017 年 8 月 17 日
編集済み: Ilham Hardy
2017 年 8 月 17 日
Can you elaborate more on your question?
What is your input and what do you expect to be the output?
If you want to search for relevant value of data2 based on the number plat:
First, search data2 for any desired keyword (in this case "DD6713MT"),
[rowid,colid] = find(ismember(data2,'DD6713MT'));
Then use rowid or colid to retrieve the information you want,
relevant_data = data2(rowid,:);
EDIT mistakenly put curly braces instead of normal braces.
Yusran Said
2017 年 8 月 17 日
Yusran Said
2017 年 8 月 17 日
Ilham Hardy
2017 年 8 月 17 日
I just realized that data2 is in table format.
To search specific string in plat,
idx = find(strcmpi('DD6713MT',data2.Plat));
To return the values of relevant table index
relevant_data = data2(idx);
Be aware that relevant_data is still in table format.
Yusran Said
2017 年 8 月 17 日
Guillaume
2017 年 8 月 17 日
find is rarely needed. In particular:
idx = find(somelogicalexpression);
result = somevector(idx);
is the same as
result = somevector(somelogicalexpression);
The latter being faster as well.
カテゴリ
ヘルプ センター および File Exchange で Structured Data and XML Documents についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!