diff options
| author | Matthias Kamuf <matthias.kamuf@hs-augsburg.de> | 2022-05-04 14:56:11 +0200 |
|---|---|---|
| committer | Matthias Kamuf <matthias.kamuf@hs-augsburg.de> | 2022-05-04 14:56:11 +0200 |
| commit | 1d5a8634e3a54bbcd2e6ac3074e6c38f085feef0 (patch) | |
| tree | 0e8ccbdac9b3f9486b50d4a97ac8147c19156015 /matlab/comms/save_variable.m | |
| parent | f37b864e1b943984739931b0950c45c6f705c679 (diff) | |
Added source files for simple FIR filter
Diffstat (limited to 'matlab/comms/save_variable.m')
| -rwxr-xr-x | matlab/comms/save_variable.m | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/matlab/comms/save_variable.m b/matlab/comms/save_variable.m new file mode 100755 index 0000000..6bc45e6 --- /dev/null +++ b/matlab/comms/save_variable.m @@ -0,0 +1,16 @@ +function save_variable (var, format, filename)
+
+% function save_variable (var, format, filename)
+%
+% Saves a variable var to filename using format,
+% e.g., save_variable (x, '%d', 'input.dat');
+
+[fid, message] = fopen(filename, 'w');
+if fid == -1
+ disp('File error. Message returned was:')
+ disp(message)
+ return
+end
+fprintf(fid, [format,'\n'], var);
+fclose(fid);
+return;
|
