how to retrieve array data with the help of index in matlab uiTable

1 view (last 30 days)
I want to access array data in Matlab GUI, i want to search the record from array on the basis of an index
load ANPR
if ismember(noPlate,ANPR(:,2))
msgbox( 'The number is Registered in database');
else
msgbox( 'The number is not Registered in database');
Info of all plate lies in VehicleDes.mat, the number is stored in noPlate after matching noPlate in array ANPR.mat i also want to show the detail information of that noPLate that lies in array VehicleDes,it might shown after clicking on ok button of msgbox or another option is to show data in uitable plz suggest how to do that
  4 Comments
Stephen23
Stephen23 on 5 Jun 2017
Edited: Stephen23 on 5 Jun 2017
@Rya: do you see how your comment is formatted like code? Do NOT put a space at the beginning of your comment and then it will be formatted as normal text.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 5 Jun 2017
[tf, idx] = ismember(ThisPlateString, CellArrayOfPlateStrings);
if ~tf
msgbox('No match')
else
Information_About_This_Plate = Information_About_All_Plates(idx, :);
end
  35 Comments
Rya
Rya on 11 Jun 2017
Edited: Rya on 11 Jun 2017
[tf, idx] = ismember(noPlate, NPR(:,2));
if ~tf
msgbox( 'The number is not Registered in database');
Information_About_This_Plate = {};
else
index_in_database = NPR{idx, 1};
Information_About_This_Plate = DB(index_in_database, :);
bgcol = [.83 .82 .78];
datacol = [1 1 1];
label=[.93 .93 .93];
fig = figure('color', bgcol, 'Units', 'pixels','Position', [10, 50, 669, 420],'Name','Vehicle Description Panel');
L0 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 10,'Position', [0 370 50 30], 'background', bgcol, 'string', 'VPN:');
L1 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15,'Position', [10 330 150 40], 'background', bgcol, 'string', 'Owner:');
L2 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15, 'Position',[10 270 150 40], 'background', bgcol, 'string', 'Vehicle Type:');
L3 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15, 'FontSize', 15,'Position',[10 220 150 40], 'background', bgcol, 'string', 'Color:');
L4 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 15,'Position',[10 170 150 40], 'background', bgcol, 'string', 'Make:');
L6 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15,'Position', [10 120 150 40], 'background', bgcol, 'string', 'Model:');
L7 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15, 'Position',[10 70 150 40], 'background', bgcol, 'string', 'Year:');
D0 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 10,'Position',[50 370 50 30], 'background',bgcol, 'string', Information_About_This_Plate{1});
D1 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 10,'Position',[170 330 150 40], 'background',datacol, 'string',(Information_About_This_Plate{2}));
D2 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 10,'Position',[170 270 150 40], 'background', datacol, 'string', Information_About_This_Plate{3});
D3 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 10,'Position', [170 220 150 40], 'background', datacol, 'string', Information_About_This_Plate{4});
D4 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 10, 'Position', [170 170 150 40], 'background', datacol, 'string', Information_About_This_Plate{5});
D5 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 10, 'Position',[170 120 150 40], 'background',datacol, 'string', Information_About_This_Plate{6});
D6 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 10, 'Position',[170 70 150 40], 'background', datacol, 'string', Information_About_This_Plate{7});
ax = axis('Parent', fig, 'Units', 'pixels', 'Position', [100 210 380 150])
% ax = axis(fig, 'Units', 'pixels', 'Position', [400 30 20 50])
ax=image(Information_About_This_Plate{8}, 'Parent', ax);
axis(ax, 'image', 'off');
end
Walter Roberson
Walter Roberson on 10 Jul 2017
You have
ax=image(Information_About_This_Plate{8}, 'Parent', ax);
axis(ax, 'image', 'off');
The first of those two lines overwrites ax with the handle to an image. You need to use a different output variable name.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!