how do i load database in m file?
Show older comments
how do i load database in m file? so that i could match value of variable with values stored in database field? A quick reply will be really appreciated. thank you
Accepted Answer
More Answers (1)
MathReallyWorks
on 25 May 2017
Hello Rya,
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.
clc;
clear all
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));
if A==1
disp('The number is not present in database');
else
disp('The number is present in database');
end
Categories
Find more on Database Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
