Structured array or hierarchy of object creation

조회 수: 1 (최근 30일)
Mounisha Ganesan
Mounisha Ganesan 2019년 9월 21일
댓글: Mounisha Ganesan 2019년 10월 5일
I want to create a set of structured arrays like this
I want to have a area element having properties like length and width, area, thickness like
AREA =[];
AREA.length= 2cm;
AREA.width=3cm;
and inside the area I want to have Fibre elements having properties
Fibre =[];
Fibre.length = 1micrometer;
Fibre.dia =0.9 micrometers.
AREA ELEMENT---->> FIBRE----->>Properties. So How should I do this flow of objects or have a subsystem in structures ?
  댓글 수: 1
David Hill
David Hill 2019년 9월 21일
I think you should look at classdef, it might be the structure you are looking for.

댓글을 달려면 로그인하십시오.

답변 (1개)

Navya Seelam
Navya Seelam 2019년 9월 24일
Hi,
You can create a structure AREA with one of its fields as structure Fibre as shown below.
AREA.length= 2;
AREA.width=3;
AREA.Fibre.length = 1e-6;
AREA.Fibre.dia =0.9e-6;
  댓글 수: 1
Mounisha Ganesan
Mounisha Ganesan 2019년 10월 5일
Thank you. I kind of did it in a similar way.
s= struct('AREA',[],'Fibre',[])
AREA.length =10;
Fibre.width =5

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by