Inserting value to a database not working...
1 view (last 30 days)
Show older comments
I have the following code which works perfectly but for the 'pix' field.
My code is:
mydir = 'E:\matlab\pet_dog\';
fid=fopen('E:\matlab\ratio for pet_dog.txt','wt');
allentries = dir(mydir);
diridxs = [allentries.isdir];
alldirs = allentries(diridxs);
allfiles = allentries(~diridxs);
for ctr = 1:length(allfiles)
x = fullfile(mydir, allfiles(ctr).name);
pix = double(nnz(edge(rgb2gray(imread(x)))));
%disp(pix);
ratio = fix(9600/pix);
logintimeout(5);
con = database('fetchDB', '', '');
ping(con);
exdata = {'9600',pix,'-',ratio,x};
colnames = {'imgSize', 'imgPixel', ' imgPart','ratio','imgName'};
fastinsert(con, 'animal', colnames, exdata)
close(con);
end
Why the field 'imgPixel' is not showing the numerical values properly? What should I do?
0 Comments
Accepted Answer
Walter Roberson
on 3 Apr 2013
Seems to me that is going to depend upon the schema you defined for the imgPixel column in the "animal" database. If it was previously defined as character, then it would stay as character until you changed the schema or deleted the database.
More Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!