KerMor  0.9
Model order reduction for nonlinear dynamical systems and nonlinear approximation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
user_string.m
Go to the documentation of this file.
1 
2 
3 /* (Autoinserted by mtoc++)
4  * This source code has been filtered by the mtoc++ executable,
5  * which generates code that can be processed by the doxygen documentation tool.
6  *
7  * On the other hand, it can neither be interpreted by MATLAB, nor can it be compiled with a C++ compiler.
8  * Except for the comments, the function bodies of your M-file functions are untouched.
9  * Consequently, the FILTER_SOURCE_FILES doxygen switch (default in our Doxyfile.template) will produce
10  * attached source files that are highly readable by humans.
11  *
12  * Additionally, links in the doxygen generated documentation to the source code of functions and class members refer to
13  * the correct locations in the source code browser.
14  * However, the line numbers most likely do not correspond to the line numbers in the original MATLAB source files.
15  */
16 
17 function string = user_string(string_name,string) {
18 if ~ischar(string_name)
19  error(" string_name must be a string. ");
20 end
21 /* Create the full filename */
22 string_name = fullfile(fileparts(mfilename(" fullpath ")), " .ignore ", [string_name " .txt "]);
23 if nargin > 1
24  /* Set string */
25  if ~ischar(string)
26  error(" new_string must be a string. ");
27  end
28  /* Make sure the save directory exists */
29  dname = fileparts(string_name);
30  if ~exist(dname, " dir ")
31  /* Create the directory */
32  try
33  if ~mkdir(dname)
34  string = false;
35  return
36  end
37  catch
38  string = false;
39  return
40  end
41  /* Make it hidden */
42  try
43  fileattrib(dname, " +h ");
44  catch
45  end
46  end
47  /* Write the file */
48  fid = fopen(string_name, " wt ");
49  if fid == -1
50  string = false;
51  return
52  end
53  try
54  fprintf(fid, " %s ", string);
55  catch
56  fclose(fid);
57  string = false;
58  return
59  end
60  fclose(fid);
61  string = true;
62 else
63  /* Get string */
64  fid = fopen(string_name, " rt ");
65  if fid == -1
66  string = ;
67  return
68  end
69  string = fgetl(fid);
70  fclose(fid);
71 end
72 return
73 }
74 
function string = user_string(string_name, string)
Definition: user_string.m:17