이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
how to retrieve array data with the help of index in matlab uiTable
조회 수: 1 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2017년 6월 5일
Could you give a small example? I can see several possible meanings for your question?
채택된 답변
Walter Roberson
2017년 6월 5일
[tf, idx] = ismember(ThisPlateString, CellArrayOfPlateStrings);
if ~tf
msgbox('No match')
else
Information_About_This_Plate = Information_About_All_Plates(idx, :);
end
댓글 수: 35
Rya
2017년 6월 5일
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
Walter Roberson
2017년 6월 5일
[tf, idx] = ismember(noPlate, ANPR(:,2));
if ~tf
msgbox( 'The number is not Registered in database');
Information_About_This_Plate = {};
else
index_in_database = ANPR{idx, 1};
Information_About_This_Plate = VehicleDes(index_in_database, :);
msgbox( ['The number is Registered to', Information_About_This_Plate{2}] );
end
However, in the data you posted for ANPR,
[2] 'KPT295'
implies that plate KPT295 should be the second plate in VehicleDes, but it is the first (and only) plate instead. Should we be ignoring the information in the first column of ANPR ?
Walter Roberson
2017년 6월 6일
You can create a figure() and put uicontrol('style', 'text') fields up with different background colors. The easiest way to display an image is to put an axes in and display the image on the axes with image() (I would not recommend imshow() for this purpose.)
Walter Roberson
2017년 6월 7일
What do you mean for all of the plates? Your noPlate variable is a single character vector indicating one plate to look up.
Instead of msgbox you can set(( ) the String field of a uicontrol 'style', 'text'
Rya
2017년 6월 7일
yes i got it but this code works in command prompt but it doesn't work in m file, why??
Walter Roberson
2017년 6월 7일
편집: Walter Roberson
2017년 6월 7일
Post your current code. And the complete error message
Walter Roberson
2017년 6월 7일
bgcol = [.6 .58 .63];
datacol = [.8 .8 .8];
fig = figure('color', bgcol, 'Units', 'pixels', 'Position', SOMETHING0);
L1 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'Position', SOMETHING1, 'background', bgcol, 'string', 'Make:');
L2 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'Position', SOMETHING2, 'background', bgcol, 'string', 'Model:');
L3 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'Position', SOMETHING3, 'background', bgcol, 'string', 'Year:');
L4 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'Position', SOMETHING4, 'background', bgcol, 'string', 'Doors:');
D1 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'Position', SOMETHING5, 'background', datacol, 'string', car_make);
D2 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'Position', SOMETHING6, 'background', datacol, 'string', car_model);
D3 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'Position', SOMETHING7, 'background', datacol, 'string', car_year);
D4 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'Position', SOMETHING8, 'background', datacol, 'string', car_doors);
ax = axes(fig, 'Units', 'pixels', 'Position', SOMETHING9, 'color', bgcol)
imh = image(ax, car_image);
axes(ax, 'image', 'off');
Rya
2017년 6월 8일
But I'm unable to show image plz tell me where I m wrong!
ax = axes(fig, 'Units', 'pixels', 'Position', [400 150 150 40], 'color', bgcol)
imh = image(ax, Information_About_This_Plate{7});
axes(ax, 'image', 'off');
Jan
2017년 6월 8일
"Unable" does not explain what happens. Do you get an error message? Note that axes does not accept the shown arguments, but axis (with i) would.
Rya
2017년 6월 8일
i asked for error in code as I'm sure i did somewhere wrong in code. so here is a Error message
Error using axes
Too many input arguments.
Error in Main>Untitled_1_Callback (line 349)
ax = axes(fig, 'Units', 'pixels', 'Position', [400 150 150 40])
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in Main (line 45)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)Main('Untitled_1_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uimenu Callback
Walter Roberson
2017년 6월 8일
Change
ax = axes(fig, 'Units', 'pixels', 'Position', SOMETHING9, 'color', bgcol)
to
ax = axes('Parent', fig, 'Units', 'pixels', 'Position', SOMETHING9, 'color', bgcol)
if you are using R2015b or older.
Walter Roberson
2017년 6월 9일
If you are using a really old version of MATLAB, then you might need
image(Information_About_This_Plate{7}, 'Parent', ax);
However, is it possible that Information_About_This_Plate{7} is empty? That would lead to that error being generated.
Rya
2017년 6월 11일
did u find any solution ?? I have tried so many solutions but google search suck so bad now.
Rya
2017년 6월 11일
still error
Error using axis>LocSetLimits (line 227)
Vector must have 4, 6, or 8 elements.
Error in axis (line 93)
LocSetLimits(ax(j),cur_arg);
Error in Main>Untitled_1_Callback (line 360)
axis(ax, image, 'off');
Walter Roberson
2017년 6월 11일
Not
axis(ax, image, 'off')
The 'image' part needs to be quoted, axis(ax, 'image', 'off')
Rya
2017년 6월 11일
편집: Rya
2017년 6월 11일
[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
2017년 7월 10일
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)