File Exchange

image thumbnail

RenameVar(matFName, originalVarName, newVarName)

version 1.1.0.0 (891 Bytes) by Weirong Chen
Rename a variable in mat file

4 Downloads

Updated 21 Nov 2014

View License

This function replaces the name of a variable ('originalVarName') in a mat file ('matFName') with a new variable name ('newVarName').
Usage: RenameVar(matFName, originalVarName, newVarName)

Example:
a=1; b=2; c=3; save('A','a','b','c');
whos('-file','A')
------------------------------------------
Name Size Bytes Class Attributes
a 1x1 8 double
b 1x1 8 double
c 1x1 8 double
------------------------------------------
RenameVar('A','a','a1');
whos('-file','A')
----------------------------------------------
Name Size Bytes Class Attributes
a1 1x1 8 double
b 1x1 8 double
c 1x1 8 double
----------------------------------------------

Cite As

Weirong Chen (2020). RenameVar(matFName, originalVarName, newVarName) (https://www.mathworks.com/matlabcentral/fileexchange/48530-renamevar-matfname-originalvarname-newvarname), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (0)

Updates

1.1.0.0

.

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux