Home > vbmeg > functions > common > utility > vb_util_save_struct_fields.m

vb_util_save_struct_fields

PURPOSE ^

save all the fields of struct

SYNOPSIS ^

function vb_util_save_struct_fields(file_name, my_struct)

DESCRIPTION ^

 save all the fields of struct
 [usage]
   vb_util_save_struct_fields(filename, my_struct)
 [input]
   file_name : <required> <<string>> saved file name
   my_struct : <required> <<struct>> the fields of this will be saved
 [output]
   none
 [note]

 [history]
   2008-04-11 (Sako) initial version

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function vb_util_save_struct_fields(file_name, my_struct)
0002 % save all the fields of struct
0003 % [usage]
0004 %   vb_util_save_struct_fields(filename, my_struct)
0005 % [input]
0006 %   file_name : <required> <<string>> saved file name
0007 %   my_struct : <required> <<struct>> the fields of this will be saved
0008 % [output]
0009 %   none
0010 % [note]
0011 %
0012 % [history]
0013 %   2008-04-11 (Sako) initial version
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 % --- CHECK ARGUMENTS --- %
0019 if ~exist('file_name', 'var'), file_name = ''; end
0020 if ~exist('my_struct', 'var'), my_struct = []; end
0021 [file_name, my_struct] = inner_check_arguments(file_name, my_struct);
0022 
0023 % --- MAIN PROCEDURE --------------------------------------------------------- %
0024 %
0025 command = sprintf('save %s -struct my_struct', file_name);
0026 fprintf(' --- exec : %s\n', command);
0027 eval(command);
0028 %
0029 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0030 
0031 
0032 % --- INNER FUNCTIONS -------------------------------------------------------- %
0033 %
0034 % --- inner_check_arguments()
0035 %
0036 function [file_name, my_struct] = inner_check_arguments(file_name, my_struct)
0037 func_ = mfilename;
0038 if isempty(file_name)
0039   error('(%s)file_name is a required parameter', func_);
0040 end
0041 
0042 if isempty(my_struct)
0043   error('(%s)my_struct is a required parameter', func_);
0044 end
0045 return;
0046 %
0047 % --- end of inner_check_arguments()
0048 %
0049 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0050 
0051 %%% END OF FILE %%%

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005