📄 m2_save.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% m2_save.m
%
% jmw
% 7/28/94
%
% saves edited S&L results to hard disk with new filename
%
% button has two modes:
%
% mode #1: presents filename for inspection & or modification
% mode #2: actually saves the data to the file if filename is visible
% modified by D. G. Childers 2/20/98 There is only one mode now
% that calls the save window and the user supplies a name.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%x=get(m2_pb_cancel_h,'Visible');
%if (strcmp('off',x) )
% set(m2_pb_cancel_h,'Visible','on');
% set(m2_e_save_h,'String',save_name);
% set(m2_e_save_h,'Visible','on');
% set(m2_pb_quit_h,'Visible','off');
% set(m2_pb_discard_h,'Visible','off');
%elseif (strcmp('on',x) )
% set(m2_pb_cancel_h,'Visible','off');
% set(m2_e_save_h,'Visible','off');
% set(m2_pb_quit_h,'Visible','on');
% set(m2_pb_discard_h,'Visible','on');
% save variables and files ...
% save_name=get(m2_e_save_h,'String');
% disp(save_name);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% create message window and write message in that window also
message_window=figure('Unit','normalized',...
'Position',[0.05 0.2 0.9 0.2],...
'Resize','off',...
'Color',BACK_COLOR,...
'Numbertitle','off',...
'Name','Message');
axis('off');
ss=sprintf('Please type only the basename for the save file, such as test, not test.m');
text(-0.05,1,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('The extension (mat) is automatically appended by this application software.');
text(-0.03,5/6,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('The extension is not automatically appended for all applications.');
text(-0.03,4/6,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('The files are saved in the temp folder.');
text(-0.03,3/6,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('Please close this window after you have saved the files or canceled save. ');
text(-0.03,2/6,ss,'color',TEXT_COLOR,'FontSize',10);
pause(3.0);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cwd=pwd;
[fname pathname]=uiputfile('*','Save file');
S=sprintf('cd %s',cwd);
eval(S);
if fname ~= 0
name_s=basename(fname);
save_name=name_s;
disp(save_name);
else
fname=o_fname;
pathname=o_pname;
end;
% save tmp results to a new file save_name...
VUS_voicetype = tmp_VUS_voicetype;
residue = tmp_residue;
cofa = tmp_cofa;
range = tmp_range;
s=sprintf('Saving ./%s_Data to hard disk ...', save_name);
disp(s);
s=sprintf('save temp/%s_Data range power cofa residue voicetype VUS_voicetype',save_name);
eval(s);
choice_1 = tmp_choice_1;
choice_2 = tmp_choice_2;
reliability_1 = tmp_reliability_1;
reliability_2 = tmp_reliability_2;
seg_cnt = tmp_seg_cnt;
seg_frame = tmp_seg_frame;
seg_range = tmp_seg_range;
seg_type = tmp_seg_type;
file_string = sprintf('%s_SegNLabels', save_name);
s=sprintf('saving ./%s to hard disk ...',file_string);
disp(s);
s1=sprintf('save temp/%s seg_cnt seg_frame seg_range seg_type choice_1 choice_2 reliability_1 reliability_2 ', file_string);
eval(s1);
% copy signal to new save_name
s=sprintf('%s = tmp_signal;', save_name);
eval(s);
file_string = sprintf('%s', save_name);
s=sprintf('saving ./%s to hard disk ...',file_string);
disp(s);
s=sprintf('save temp/%s %s', file_string, file_string);
eval(s);
% NOW, RESTORE TMP VARIABLES !!!
% create temporary/new SegNLabel variables
tmp_choice_1 = choice_1;
tmp_choice_2 = choice_2;
tmp_reliability_1 = reliability_1;
tmp_reliability_2 = reliability_2;
tmp_seg_cnt = seg_cnt;
tmp_seg_frame = seg_frame;
tmp_seg_range = seg_range;
tmp_seg_type = seg_type;
% create temporary/new Data variables
tmp_range = range;
tmp_cofa = cofa;
tmp_residue = residue;
tmp_VUS_voicetype = VUS_voicetype;
% create temporary/new signal variables
s=sprintf('tmp_signal=%s;', save_name);
eval(s);
%tmp_signal = signal;
s=sprintf('clear %s', save_name);
eval(s);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load signal
file_string=sprintf('temp/%s',name);
s=sprintf('loading %s',file_string);
disp(s);
s=sprintf('load %s',file_string);
eval(s);
s=sprintf('signal=%s;', name);
eval(s);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load Data
file_string=sprintf('temp/%s_Data',name);
s=sprintf('loading LPC analysis results from %s',file_string);
disp(s);
s=sprintf('load %s',file_string);
eval(s);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% load segmentation data
file_string=sprintf('temp/%s_SegNLabels.mat',name);
s=sprintf('loading segmentation & labeling results from %s',file_string);
disp(s);
s=sprintf('load %s',file_string);
eval(s);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
m2_d1_di;
save_cntr = save_cntr + 1;
save_name=sprintf('%s%d', name, save_cntr);
%end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -