Get data out of a struct to manipulate

3 ビュー (過去 30 日間)
Katherine
Katherine 2023 年 7 月 14 日
回答済み: Cris LaPierre 2023 年 7 月 14 日
I have created a struct where the first bit is just a name, and the second bit is a bunch of data
I want to get the data out of the struct so I can manipulate it and put it into a table or an array

回答 (1 件)

Cris LaPierre
Cris LaPierre 2023 年 7 月 14 日
Extract the data using the structurename.fieldname syntax. See here: https://www.mathworks.com/help/matlab/matlab_prog/create-a-structure-array.html
% create the structure
patient.test = [79 75 73; 180 178 177.5; 220 210 205]
patient = struct with fields:
test: [3×3 double]
% Extract the data
data = patient.test
data = 3×3
79.0000 75.0000 73.0000 180.0000 178.0000 177.5000 220.0000 210.0000 205.0000

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by