Change data contained in a binary .mat file

1 Ansicht (letzte 30 Tage)
Cg Gc
Cg Gc am 27 Jun. 2025
Kommentiert: Cg Gc am 8 Jul. 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 Kommentar
Dyuman Joshi
Dyuman Joshi am 27 Jun. 2025
As the error states, did you try running it with '-ASCII' option?
in = load("/MATLAB Drive/Published/Core Dating/matchfiles/SDMJ.mat"', '-ASCII')

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Benjamin Kraus
Benjamin Kraus am 27 Jun. 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 Kommentar
Cg Gc
Cg Gc am 8 Jul. 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by