Moving specific .mat files to a new folder

8 visualizaciones (últimos 30 días)
Rafia Ahsan
Rafia Ahsan el 14 de Abr. de 2021
Editada: madhan ravi el 14 de Abr. de 2021
I have 766 .mat files in a folder. Whenever I load these files in MATLAB, a variable named cjdata is loaded in the work space and each .mat file has 5 variable stored in it and one of them is label. 3 different labels i.e. 1, 2 and 3 are assigned to each of the .mat file. I want to store .mat files with same labels in one folder. Can anyone tell me how I can do it?

Respuestas (1)

madhan ravi
madhan ravi el 14 de Abr. de 2021
Editada: madhan ravi el 14 de Abr. de 2021
help movefile
MOVEFILE Move or rename file or folder. [STATUS,MESSAGE,MESSAGEID] = MOVEFILE(SOURCE) moves the file or folder SOURCE to the current folder. MOVEFILE does not preserve the archive attribute of SOURCE. MOVEFILE cannot move a file onto itself. [STATUS,MESSAGE,MESSAGEID] = MOVEFILE(SOURCE,DESTINATION) moves SOURCE to the file or folder DESTINATION. If SOURCE and DESTINATION are in the same location, then MOVEFILE renames SOURCE to DESTINATION. If SOURCE ends in a wildcard (*), all matching file objects are moved to DESTINATION. [STATUS,MESSAGE,MESSAGEID] = MOVEFILE(SOURCE,DESTINATION,'f') moves SOURCE to DESTINATION, as above, even if DESTINATION is read-only. The state of the writable attribute of DESTINATION is preserved. INPUT ARGUMENTS: SOURCE: Character vector or string scalar specifying the source file or folder. SOURCE can be an absolute or relative path. UNC paths are supported. To copy multiple files or folders, use wildcards (*). DESTINATION: Character vector or string scalar specifying the destination file or folder. DESTINATION can be an absolute or relative path, but cannot include wildcards (*). UNC paths are supported. OUTPUT ARGUMENTS: STATUS: Logical scalar indicating if the attempt to move the file or folder is successful. If the attempt is successful, STATUS is 1. Otherwise, STATUS is 0. MESSAGE: Character vector containing the error message. If an error or warning occurs, MESSAGE contains the message text of the error or warning. Otherwise, MESSAGE is empty (''). MESSAGEID: Character vector containing the error message identifier. If an error or warning occurs, MESSAGEID contains the message identifier of the error or warning. Otherwise, MESSAGEID is empty (''). See also CD, COPYFILE, DELETE, DIR, FILEATTRIB, MKDIR, RMDIR. Documentation for movefile doc movefile

Categorías

Más información sobre File Operations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by