Integrating Matlab project with c# application with visual studio C#.

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

2 Comments

What does integrate these actually mean?
What is it that you don't know how to do?
Integrate mean to combine 2 different modules in one project

Sign in to comment.

Answers (1)

19 Comments

Sorry, I know very little about .NET assemblies.
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
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, :);
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?
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
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
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
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;
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
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
set(handles.DBtable, 'data', DB) %update your uitable
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, :);
You are making me do a lot of guessing about what you might have written in your code.
How should i make you clear?
... by posting your code? Untitled_1_Callback at the very least, but I suspect I might need more.
%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');
%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');
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?

Sign in to comment.

Categories

Find more on Programming in Help Center and File Exchange

Asked:

Rya
on 10 Jul 2017

Commented:

Rya
on 17 Jul 2017

Community Treasure Hunt

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

Start Hunting!