Change data contained in a binary .mat file

1 visualización (últimos 30 días)
Cg Gc
Cg Gc el 27 de Jun. de 2025
Comentada: Cg Gc el 8 de Jul. de 2025
I am trying to change some data held in a .mat file. The file appears as a variable in the workspace and I open the file in the variable editor, but I can't seem to be able to make changes this way. I can't load or run the file. I have the file in the correct folder and the folder has been added to the path. I can open the file an see the data in the variable area. This is the data that I need to adjust. When I try to adjust the data using the variable editor, I can't save it and the data doesn't stay if I close it and reopen it.
The file contains two columns and 62 rows of data of data for a single variable.
Is there a way to modify the data in a binary mat file? I am using MATLAB Online, so I am assuming the usual commands don't work all that well.
load("/MATLAB Drive/SDMJ.mat")
matchmaker('files_secondary',[8],[5])
Matchpoint file SDMJ.mat not found
load("/MATLAB Drive/Published/Core Dating/matchfiles/SDMJ.mat")
Error using load
Unable to read MAT-file /MATLAB Drive/Published/Core Dating/matchfiles/SDMJ.mat. Not a binary MAT-file. Try load -ASCII to read as text.
  1 comentario
Dyuman Joshi
Dyuman Joshi el 27 de Jun. de 2025
As the error states, did you try running it with '-ASCII' option?
in = load("/MATLAB Drive/Published/Core Dating/matchfiles/SDMJ.mat"', '-ASCII')

Iniciar sesión para comentar.

Respuestas (1)

Benjamin Kraus
Benjamin Kraus el 27 de Jun. de 2025
You can't view a MAT-file in the Variable Editor without first loading the contents into MATLAB, so if you are seeing the contents, it sounds to me like you accidentally named an ASCII file with ".MAT" as the file extension and you are viewing the text in the regular Editor.
If you attach the file to your question we can confirm the format of the file.
  1 comentario
Cg Gc
Cg Gc el 8 de Jul. de 2025
Unfortunately, the file is really big. It has a lot of data in it.
I was able to edit it by copying a working data file and then just changing the name. It seems to work how. I am not sure why it wouldn't work before.

Iniciar sesión para comentar.

Categorías

Más información sobre Environment and Settings 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