GUI transpose code encounter some errors
Afficher commentaires plus anciens
Hi guys,
I have a code for store and compare photos in a DB and its works fine
clc;
clear all;
close all;
%% Taking an Image
[fname, path]=uigetfile('.jpg');
fname=strcat(path, fname);
im=imread(fname);
im=im2bw(im);
imshow(im);
title('Photo');
answer=inputdlg('Enter the Class(Number from 1-200) ');
str2num(answer{1});
result=ans;
close;
msgbox('Loaded in DB');
%% Feature Extraction
F=FeatureStatistical(im);
try
load db;
F=[F result];
db=[db; F];
save db.mat db
catch
db=[F result]; % 10 200 1
save db.mat db
end
I want to put it in a gui for making an app, but I have this error:
Error: File: load_foto.m Line: 103 Column: 5
"db" previously appeared to be used as a function or command, conflicting with its use here as the name of a variable.
A possible cause of this error is that you forgot to initialize the variable, or you have initialized it implicitly using
load or eval.
The code for thegui loks like this:
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
[fname, path]=uigetfile('.jpg');
fname=strcat(path, fname);
im=imread(fname);
im=im2bw(im);
imshow(im);
title('Photo');
prompt={'Insert class'};
introducere='Input';
num_lines=1;
def={''};
answer=inputdlg(prompt,introducere,num_lines,def);
str2num(answer{1});
result=ans;
close;
msgbox('Succesfully loaded');
%% Feature Extraction
F=FeatureStatistical(im);
try
load db;
F=[F result];
db=[db; F];
save db.mat db
catch
db=[F result]; % 10 200 1
save db.mat db
end
for competition I leave also the Feature statistical code:
function [F]=FeatureStatistical(im)
% Summary of this function goes here
im=double(im);
m=mean(mean(im));
s=std(std(im));
F=[m s];
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!