Unpacking structured Data with multiple Fields

19 ビュー (過去 30 日間)
Andy Wileman
Andy Wileman 2021 年 3 月 13 日
コメント済み: Andy Wileman 2021 年 3 月 16 日
Hi,
I was wondering if anyone has any experience of extracting data variables from mulitple structures?
What I would like to do is extract the data contained in .measurement.transient.timeDomain for each structure, see pic below The data is contained as structures with 110 fields. I can do this for one of the Field lines at a time, but is there a way to extract all the data in one go? The picture below show the structure and the bottom pic shows the data in a single 1x1 timeDomain structure.
Kind regards,
Andy
  2 件のコメント
Walter Roberson
Walter Roberson 2021 年 3 月 13 日
? Your image implies 5 fields for each time domain structure, with time domain being part of a struct array. Is it possible that it is the structure array that has 110 elements, each of which is a struct with 5 fields.
Andy Wileman
Andy Wileman 2021 年 3 月 14 日
Hi Walter,
Thanks for getting back to me. Yes that sounds correct, there are 110 elements(or rows). I click on the initial structure 'measurement' which brings up all the measurements, then click on measurement.transient. This contains that data I require (timeDomian).
What I was aiming to do is generate 110 data files. These will have the "date information" from each row as their file name, and the data contained in the measurement.transient.timeDomain structure for that row. This seems to be the required formart for importing into the Predictive Maintenance Toolbox (apparently, it can read the date/time from the file name header).
I'm afraid where I understand the basics of Matlab, structures scare me to death. I was just wondering if its possible to automate the process as I have similar data from other devices.
and is set number 8. IGBT Accelerated Aging Data Set
IGBTAgingData_04022009.zip\IGBTAgingData_04022009\Data\Thermal Overstress Aging with Square Signal at gate and SMU data\Aging Data
Kind regards,
Andy

サインインしてコメントする。

採用された回答

Aghamarsh Varanasi
Aghamarsh Varanasi 2021 年 3 月 16 日
Hi Andy,
If you want to create a variable to store the data contained in 'measurement.transient.timeDomain', you can use the following syntax. This will save all the structures in a cellarray.
data = {measurement.transient.timeDomain}.';
Hope this helps
  2 件のコメント
Andy Wileman
Andy Wileman 2021 年 3 月 16 日
Thanks Aghamarsh, I'll give this ago.
Andy Wileman
Andy Wileman 2021 年 3 月 16 日
Hi Aghamarsh,
I've got this far. I'm still having problems saving the time and date information contained in dateName as a filename, I've tried to use a conversion via datenum, so it doesn't contain any symbols that aren't allowed. Also, the timeDom is still in the form of a structure not a double. I wondered if you may have any ideas?
Kind regards,
Andy
load('Device2_13032021.mat');
L = length(measurement.transient);
for i = 1:L
dateName = {measurement.transient(i).date};
timeDom = {measurement.transient(i).timeDomain};
% TODO: Save files
%t = datenum(dateName,'dd/mm/yyyy,HH:MM:SS');
save(['Data' num2str(i) 't'],'timeDom')
end

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by