How can I load a field from a struct that is stored within a .mat file?

44 visualizzazioni (ultimi 30 giorni)
Hello, I am hoping someone here could help me with figuring out how to save a part of a struct that I have. Basically, this struct originates from data loaded into matlab through an extension (Delft3D Quickplot). This struct, called 'data' is savable within a .mat file, but I actually only need 3 variables: Val, X and Y. I need this since I want to get time series of water depths (which is what the val or value refers to) for specific coordinates. I have tried loading only a variable in ways such as: b = load('matlab.mat', 'Val') or using var = load( fullfile('D:\ directory path', 'matlab.Mat'), 'Val' ); but these options do not seem to work. I would really appreciate the help and suggestions.
Kind regards,

Risposta accettata

Walter Roberson
Walter Roberson il 26 Mag 2023
If the .mat file was saved with -v7 (the default for most people) then the operations will be permitted but will still require loading the entire variable into memory and so will not have the hoped-for efficiency.

Più risposte (0)

Categorie

Scopri di più su Structures in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by