Creating a structure using doubles from within other structures
Ältere Kommentare anzeigen
I am loading in 2 .mat files that are both structures, however need to use values from doubles within the structure to create a new structure called data. Where each double is 15365 x 1 double.
load LEJ3.mat %(1x1 struct)
load LEJ3WAVE.mat %(1x1 struct)
Create a structure for the data:
data.time = struct(LEJ3WAVE.data.wave_height.time); %data time from LEJ3 from January 1, 2021 to January 1, 2022 (datetime in 30 minute intervals)
data.wavehgt1 = struct(LEJ3WAVE.data.wave_height.values); %wave height values (meters)
data.waveper1 = struct(LEJ3WAVE.data.wave_period.values); %wave period values (seconds)
data.wavedir1 = struct(LEJ3WAVE.data.wave_direction.values); %wave direction (degrees)
data.windspd1 = struct(LEJ3.data.wind_speed.values); %wind speed (meters/second)
data.winddir1 = struct(LEJ3.data.wind_from_direction.values); %wind direction (degrees North)
I keep receiving:
Error using struct. Conversion to struct from double is not possible.
Am I supposed to break down the double into an array or is what I'm trying to accomplish simply not feasible?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Structures finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!