-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy paththeory_deletedb.m
More file actions
30 lines (30 loc) · 991 Bytes
/
theory_deletedb.m
File metadata and controls
30 lines (30 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function theory_deletedb()
global materialdb
if (isempty(materialdb.pname) == 1)
msgbox('No record has been found.','Database warning','warn','modal');
return
end %if
for i=1:length(materialdb.pname)
list{i} = [materialdb.pname{i} ' - ' materialdb.sname{i} ' (' materialdb.mname{i} ')'];
end %i
[s,ok] = listdlg('Name','Properties Database',...
'PromptString',{'Please select to delete', ''},...
'SelectionMode','multiple','ListString',list);
if (ok == 0)
return
end %if
choice = questdlg(['Are you sure you want to delete ' num2str(length(s)) ' record(s)?'], ...
'Database', ...
'Yes','No','No');
cpath = getcurrentdir();
switch choice
case 'Yes'
materialdb.pname(s) = [];
materialdb.sname(s) = [];
materialdb.mname(s) = [];
materialdb.mdb(s) = [];
save([cpath '\matdb.dat'],'materialdb')
msgbox([num2str(length(s)) ' record(s) was deleted.'],'Database','help','modal');
case 'No'
return
end %switch