how do i load database in m file?
16 views (last 30 days)
Walter Roberson on 25 May 2017
In https://www.mathworks.com/matlabcentral/answers/340650-how-can-i-match-a-value-in-variable-with-data-stored-in-database#comment_455338 you indicate that your database is stored in an SQL server.
You cannot meaningfully load an SQL database into a MATLAB session. What you can do is make queries against a database to retrieve the information stored there. For information about that, see https://www.mathworks.com/help/database/import-data.html
... However, it is questionable as to why you bothered to store your license plate related information in an SQL server, unless you have a lot of license plate information. containers.Map() would probably be sufficient for your purposes.
More Answers (1)
MathReallyWorks on 25 May 2017
Use this to load the database in your workspace:
1. Go to home
2. Click on Import Data
3. Select your file. (I'll suggest to keep data in excel sheet)
4. A window will appear
5. click on import selection and remember the names of variable(Use that variable name in code given below)
Now, use this code to check whether the particular number is present in database or not.
X = [1 323 2 44 3 66 77 88 2 1 2 3 34 56 78 5 7 4 44 28]; %Sample DataBase
%Remove above line and replace X by variable name of your database
b = input('enter the number you want to check:');
n = find(X==b);
A = isempty(X(n));
disp('The number is not present in database');
disp('The number is present in database');