How to compare workspace variable to variable saved on disk and save if different.

조회 수: 1 (최근 30일)
Octavian
Octavian 2015년 1월 28일
편집: Octavian 2015년 1월 28일
Dear All,
here is my challenge. I use an script that generates an output variable varx in workspace and saves it to a binary file filey (location path/filey) every time it is run, overriding the prior save.
I want that with each run, the script generates the new varx, and compares it automatically with the saved varx in filey.mat. If the two are identical (not just the name, but identical in all attributes), then the new varx should not be saved as there is no point.
If the two are not identical, the I want to change the name of the saved (old) filey mat wrapper to filey_d, where d is the date of 'last modified' as in Windows explorer (If this is difficult, another option would be to change filey name to filey_d, where d is the current date); and save the current varx in workspace in a new filey binary ('filey' name is not dynamic). A such, the filey would include the most recent varx, which could be imported and processed by the script later, but old varx-es would be stored as well on disk. Also, I do not want to change the old varx name, but the name of its wrapper binary (filey).
I mention that varx data types are double matrices, figures, and cell arrays.
Thank you for assist,
Octavian

답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by