How I can read .dat file and store its value in MYSQL table.

조회 수: 3 (최근 30일)
Shiza
Shiza 2012년 4월 25일
답변: Piyush Kumar 2024년 11월 28일
Hello everyone I m working on fingerprint recognition project. I have develop a code which will take fingerprint image and will perform further steps on it. At last step it will extract the minutiae and store it in a file with .dat extension. My question is that, How I can read this .dat file and store its value in MYSQL table. Thanks in advance Shiza

답변 (1개)

Piyush Kumar
Piyush Kumar 2024년 11월 28일
Hi,
You can read the ".dat" file using the fopen and textscan functions.
For example,
% Create sample data
data = {'John', 28; 'Jane', 32; 'Doe', 45};
fileID = fopen('sample.dat', 'w');
% Write data to the file
for i = 1:size(data, 1)
fprintf(fileID, '%s %d\n', data{i, 1}, data{i, 2});
end
fclose(fileID);
% Open the file for reading
fileID = fopen('sample.dat', 'r');
data = textscan(fileID, '%s %d');
fclose(fileID);
To store the values in MySQL table,
  • Connect to the database using the database function
  • Create a Table in MySQL
  • Use the sqlwrite function to insert data into the table

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by