You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Integrating Matlab project with c# application with visual studio C#.
4 views (last 30 days)
Show older comments
I have created one module i.e (Vehicle number plate recognition) in MatLab and the other module (vehicle management system) in C#, Now i want to integrate these. Help me kindly
Answers (1)
Walter Roberson
on 10 Jul 2017
19 Comments
Rya
on 10 Jul 2017
actually i found difficult to update and delete data from cell array thats why i decided to shift to C#, Can u help me that problem
Walter Roberson
on 10 Jul 2017
Please ask a more specific question about cell arrays.
You use cell arrays much the same way you use other arrays. Construct a logical vector indicating for each row whether the row matches the criteria you have in mind. Then you can use that vector to act on corresponding elements. For example,
car_is_blue = ismember(ANPR(:,6), 'blue');
car_is_sedan = ismember(ANRP(:,7), 'sedan');
car_is_blue_sedan = car_is_blue & car_is_sedan;
blue_sedan_entries = ANPR(car_is_blue_sedan, :);
Rya
on 11 Jul 2017
I m able to show data from cell arrays i.e data about vehicles. now i want to add new data in same cell array and also want to delete specfic data from cell array, how to do that please help?
Walter Roberson
on 11 Jul 2017
ANPR(end+1,:} = CellWithNewData; %to add data
car_is_blue = ismember(ANPR(:,6), 'blue');
car_is_sedan = ismember(ANRP(:,7), 'sedan');
car_is_blue_sedan = car_is_blue & car_is_sedan;
blue_sedan_entries = ANPR(car_is_blue_sedan, :);
ANPR(blue_sedan_entries,:) = []; %to delete specific data
Rya
on 12 Jul 2017
This is difficult to understand for me , because here the data that i want to add in a cell array is gathered from user through input dilog box, when user enters data in input dilog box it should automatically store in cell array
Walter Roberson
on 12 Jul 2017
prompt = {'Enter license plate', 'Enter owner', 'Enter model', 'Enter color', 'Enter year', 'Enter VID'};
dlg_title = 'Enter registration information';
responses = inputdlg(prompt, dlg_title);
new_ANPR_row = responses(:).'; %turn it into a row vector
ANPR(end+1, :) = new_ANPR_row; %add the entry to the end
Rya
on 12 Jul 2017
this is an array and i want to store every new input in this .
error while using below code
_Subscripted assignment dimension mismatch._
load('DB.mat')
prompt = {'Enter license plate', 'Enter owner', 'Enter model', 'Enter color', 'Enter year', 'Enter VID'};
responses = inputdlg(prompt, dlg_title);
new_ANPR_row = responses(:).'; %turn it into a row vector
DB(end+1, :) = new_ANPR_row;
Walter Roberson
on 12 Jul 2017
filestruct = load('DB.mat');
DB = filestruct.DB;
prompt = {'Enter license plate', 'Enter owner', 'Enter Vehicle type', 'Enter color', 'Enter manufacturer', 'Enter model', 'Enter year', 'Enter Image file name'};
dlg_title = 'Enter registration information';
responses = inputdlg(prompt, dlg_title);
new_DB_row = responses(:).'; %turn it into a row vector
year_numeric = str2double(new_DB_row{7});
if ~isnan(year_numeric); new_DB_row{7} = year_numeric; end
new_DB_row{8} = uint8(new_DB_row{8}(:)); %I don't know why you do not just leave the file name as a character vector
DB(end+1, :) = new_DB_row; %add the entry to the end
save DB DB
Rya
on 12 Jul 2017
It works thank you so very much . but when i store data in array, It definetly get stored but when i wish to search or see record/data back in array it requires closing array then opening it again, that does not make a good impression, mean it requires to be refreshed , is there any way to refresh it automatically
Rya
on 13 Jul 2017
As i have entered data successfully in cell array but it still gives error while retrieving
Error: Index exceeds matrix dimensions.
Error in Main>Untitled_1_Callback (line 358)
Information_About_This_Plate = DB(index_in_database, :);
Walter Roberson
on 13 Jul 2017
You are making me do a lot of guessing about what you might have written in your code.
Walter Roberson
on 13 Jul 2017
... by posting your code? Untitled_1_Callback at the very least, but I suspect I might need more.
Rya
on 14 Jul 2017
%this is to store/save data in array DB.mat
filestruct = load('DB.mat');
DB = filestruct.DB;
prompt = {'Enter VPN', 'Enter owner', 'Enter Vehicle type', 'Enter color', 'Enter Make', 'Enter model', 'Enter year', 'Enter Image file name'};
dlg_title = 'Enter registration information';
responses = inputdlg(prompt, dlg_title);
new_DB_row = responses(:).'; %turn it into a row vector
year_numeric = str2double(new_DB_row{7});
if ~isnan(year_numeric); new_DB_row{7} = year_numeric; end
new_DB_row{8} = uint8(new_DB_row{8}(:));
DB(end+1, :) = new_DB_row;
save DB DB
set(handles.DBtable, 'data', DB)
%This is to retrieve data
function New_Vehicle_Callback(hObject, eventdata, handles)
load('NPR.mat')
prompt = {'Enter Vehicle Id', 'Enter VNP'};
dlg_title = 'Enter registration information';
responses = inputdlg(prompt, dlg_title);
new_NPR_row = responses(:).';
NPR(end+1, :) = new_NPR_row;
save NPR NPR
%set(handles.NPRtable, 'data', NPR)
filestruct = load('DB.mat');
DB = filestruct.DB;
prompt = {'Enter VPN', 'Enter owner', 'Enter Vehicle type', 'Enter color', 'Enter Make', 'Enter model', 'Enter year', 'Enter Image file name'};
dlg_title = 'Enter registration information';
responses = inputdlg(prompt, dlg_title);
new_DB_row = responses(:).'; %turn it into a row vector
year_numeric = str2double(new_DB_row{7});
if ~isnan(year_numeric); new_DB_row{7} = year_numeric; end
new_DB_row{8} = uint8(new_DB_row{8}(:)); %I don't know why you do not just leave the file name as a character vector
DB(end+1, :) = new_DB_row;
save DB DB
set(handles.DBtable, 'data', DB)
function Search_panel_Callback(hObject, eventdata, handles)
global noPlate
load NPR.mat
load DB.mat
[tf, idx] = ismember(x, NPR(:,2));
if ~tf
errordlg( 'Vehicle with VPN is not found','Error');
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, 609, 470],'Name','Vehicle Description Panel');
L0 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15,'Position', [430 370 50 30], 'background', bgcol, 'string', 'VPN:');
L1 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15,'Position', [20 330 150 40], 'background', bgcol, 'string', 'Owner:');
L2 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15, 'Position',[20 270 150 40], 'background', bgcol, 'string', 'Vehicle Type:');
L3 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15, 'FontSize', 15,'Position',[20 220 150 40], 'background', bgcol, 'string', 'Color:');
L4 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 15,'Position',[20 170 150 40], 'background', bgcol, 'string', 'Make:');
L5 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15,'Position', [20 120 150 40], 'background', bgcol, 'string', 'Model:');
L6 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15, 'Position',[20 70 150 40], 'background', bgcol, 'string', 'Year:');
D0 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 15,'Position',[480 370 100 30], 'background',bgcol, 'string', Information_About_This_Plate{1});
D1 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 12,'Position',[180 330 150 40], 'background',datacol, 'string',(Information_About_This_Plate{2}));
D2 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 12,'Position',[180 270 150 40], 'background', datacol, 'string', Information_About_This_Plate{3});
D3 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 12,'Position', [180 220 150 40], 'background', datacol, 'string', Information_About_This_Plate{4});
D4 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 12, 'Position', [180 170 150 40], 'background', datacol, 'string', Information_About_This_Plate{5});
D1 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 12, 'Position',[180 120 150 40], 'background',datacol, 'string', Information_About_This_Plate{6});
D2 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 12, 'Position',[180 70 150 40], 'background', datacol, 'string', Information_About_This_Plate{7});
ax = axis(fig, 'Units', 'pixels', 'Position', [400 30 20 50])
axi=image(Information_About_This_Plate{8}, 'Parent', ax);
axis(axi, 'image', 'off');
Walter Roberson
on 15 Jul 2017
%notice I got rid of NPR file
function New_Vehicle_Callback(hObject, eventdata, handles)
filestruct = load('DB.mat');
DB = filestruct.DB;
prompt = {'Enter VPN', 'Enter owner', 'Enter Vehicle type', 'Enter color', 'Enter Make', 'Enter model', 'Enter year', 'Enter Image file name'};
dlg_title = 'Enter registration information';
responses = inputdlg(prompt, dlg_title);
new_DB_row = responses(:).'; %turn it into a row vector
year_numeric = str2double(new_DB_row{7});
if ~isnan(year_numeric); new_DB_row{7} = year_numeric; end
new_DB_row{8} = new_DB_row{8};
DB(end+1, :) = new_DB_row;
save DB DB
set(handles.DBtable, 'data', DB)
function Search_panel_Callback(hObject, eventdata, handles)
filestruct = load('DB.mat');
DB = filestruct.DB;
[tf, idx] = ismember(x, DB(:,1));
if ~tf
errordlg( 'Vehicle with VPN is not found','Error');
Information_About_This_Plate = {};
return
end
Information_About_This_Plate = DB(idx, :);
bgcol = [.83 .82 .78];
datacol = [1 1 1];
label=[.93 .93 .93];
fig = figure('color', bgcol, 'Units', 'pixels','Position', [10, 50, 609, 470],'Name','Vehicle Description Panel');
L0 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15,'Position', [430 370 50 30], 'background', bgcol, 'string', 'VPN:');
L1 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15,'Position', [20 330 150 40], 'background', bgcol, 'string', 'Owner:');
L2 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15, 'Position',[20 270 150 40], 'background', bgcol, 'string', 'Vehicle Type:');
L3 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15, 'FontSize', 15,'Position',[20 220 150 40], 'background', bgcol, 'string', 'Color:');
L4 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 15,'Position',[20 170 150 40], 'background', bgcol, 'string', 'Make:');
L5 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15,'Position', [20 120 150 40], 'background', bgcol, 'string', 'Model:');
L6 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 15, 'Position',[20 70 150 40], 'background', bgcol, 'string', 'Year:');
D0 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 15,'Position',[480 370 100 30], 'background',bgcol, 'string', Information_About_This_Plate{1});
D1 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 12,'Position',[180 330 150 40], 'background',datacol, 'string',(Information_About_This_Plate{2}));
D2 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 12,'Position',[180 270 150 40], 'background', datacol, 'string', Information_About_This_Plate{3});
D3 = uicontrol(fig, 'style', 'text', 'units', 'pixels', 'FontSize', 12,'Position', [180 220 150 40], 'background', datacol, 'string', Information_About_This_Plate{4});
D4 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 12, 'Position', [180 170 150 40], 'background', datacol, 'string', Information_About_This_Plate{5});
D1 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 12, 'Position',[180 120 150 40], 'background',datacol, 'string', Information_About_This_Plate{6});
D2 = uicontrol(fig, 'style', 'text', 'units', 'pixels','FontSize', 12, 'Position',[180 70 150 40], 'background', datacol, 'string', Information_About_This_Plate{7});
imfile = Information_About_This_Plate{8};
if ~ischar(imfile)
imfile = char(imfile(:).');
end
if isempty(imfile) || ~exists(imfile, 'file')
fids = {'testpat1.png', 'pout.tif', 'kobi.png'};
imfile = fids{randi(length(fids))};
end
ax = axis(fig, 'Units', 'pixels', 'Position', [400 30 20 50]);
[imcontent, immap] = imread(imfile);
if ~isempty(immap)
imcontent = ind2rgb(imcontent, immap);
end
axi = image(imcontent, 'Parent', ax);
axis(axi, 'image', 'off');
Rya
on 17 Jul 2017
The above works well (y) but the last one is to show image in axis?? Its not working, tell me in which format should i save image in array?
See Also
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)