|
本帖最后由 tenglang 于 2011-5-13 21:07 编辑
对于mat格式的追加,参考help
具体参考 save 带的参数
- Appending to an Existing File
- You can add new variables to those already stored in an existing MAT-file by using save -append. When you append to a MAT-file, MATLAB first looks in the designated file for each variable name specified in the argument list, or for all variables if no specific variable names are specified. Based on that information, MATLAB does both of the following:
- *
- For each variable that already exists in the MAT-file, MATLAB overwrites its saved value with the new value taken from the workspace.
- *
- For each variable not found in the MAT-file, MATLAB adds that variable to the file and stores its value from the workspace.
- Note Saving with the -append option does not append additional elements to any arrays that are already saved in the MAT-file.
复制代码
非高级数据格式的存储参考help中的例子
Export Binary Data with Low-Level I/O- Example — Appending Binary Data to an Existing File
- Add the values [55 55 55 55] to the end of the changing.bin file created in the previous example.
- % open the file to append and read
- fid = fopen('changing.bin','a+');
- % write values at end of file
- fwrite(fid,[55 55 55 55]);
- % read the results from the file into a 4-by-5 matrix
- frewind(fid);
- appended = fread(fid, [4,5])
- % close the file
- fclose(fid);
- The appended data in the file changing.bin is:
- 16 44 3 13 55
- 5 44 10 8 55
- 9 44 6 12 55
- 4 44 15 1 55
复制代码 |
|