SlideShare a Scribd company logo
TOPIC:- STRUCTURE ARRAYS
Presented by :
 About MATLAB
 Arrays
 Types of arrays
 Structure arrays
 Creating structures
 Structure functions
 Program
 Accessing structure arrays
 Summary
 MATLAB (matrix laboratory) is a fourth-generation high-level
programming language and interactive environment for
numerical computation.
 MATLAB is widely used as a computational tool in science
and engineering encompassing the fields of physics ,
chemistry, math and all engineering streams.
It is a range of applications including:
• Signal processing and communications
• Control systems
• Computational biology
 It is started developing MATLAB in
the late 1970s.
 CLEVE MOLER , the chairman of the
computer science department at the
university of New Mexico .
 Moler and Steve Bangert together
rewrote MATLAB in ‘C’ and founded
Math works in 1984 to continue its
development.
CLEVE MOLER
STEVE BANGERT
 One of the strength of MATLAB is the capability to handle
collections of items , called ARRAYS ,as if they were a single
entity.
 The array-handling feature means that MATLAB programs
can be very short.
 The array is the basic building block in MATLAB.
 Numeric array
 Character array
 Logical array
 Cell array
 Structure array
 Function handle array
 Java array
 Structure arrays are composed of structures.
 Numeric, character and cell arrays all reference the individual
elements by number.
 Structures reference individual elements within each row
(called “fields”) by name.
 To access these fields, the dot “.” notation is used.
 Assignment is as follows:
Structurename.Fieldname = datatype;
 Let’s create a simple structure:
>>Person . first name = ‘ramesh’;
Person .Last name = ‘ babu ’;
Person.Address1 = ‘china’;
Person . city = ‘america’;
Person . state = ‘US’;
Person . Zip = ‘30332-0001
 >>person=
first name: ’Ramesh’
last name: ’Babu’
address1:’china’
city : ‘America’
state : ‘US’
Zip: ‘30332-0001’
By creating simple structure then type in command window
person that will display above result i.e is related to
person details . Person(1) also gives same information.
 s= struct(‘f1’,’v1’,’f2’,’v2’,...)
creates a structure array with the fields ‘f1’,’f2’,…
having the values ‘v1’,’v2’,...
Ex:
>>s= struct(‘type’,{‘big’,’little’},’color’,’red’,’x’,{3 4})
s=1x2 struct array with the fields:
type
color
x
.
.
 names=fieldnames(s)
Return the fields names associated with the
structure array S as names , a cell array of strings.
Ex: >>names=fieldnames(s)
names=‘type’
‘color’
‘x’
 isfield(s,’field’)
returns 1 if ‘field’ is the name of a field in the
structure array s and 0 otherwise.
Ex: >>isfield(s,’field’)
ans=0
>>isfield(s,{‘type’,’color’,’x’})
ans=1 1 1
 isstruct(s)
Returns 1 if the array s is a structure array and 0
otherwise
Ex: >>isstruct(s)
ans=1
 s=rmfield(s,’field’)
removes the field ‘field’ from the structure
array s
 Ex: >>s=rmfield(s,’type’)
s=1x2 struct array with fields:
color
x
These are the structure functions and there
descriptions.
 c=structure2cell(s)
converts structure array to cell array.
Ex: >>clear s, s.category=‘tree’;s.height=37.4;
s.name=‘bamboo’;
>>c=struct2cell(s)
c= ‘tree’
[37.4000]
‘bamboo’
>>f=fieldnames(s)
f=‘category’
‘height’
‘name’
 s=cell2struct(c,fields,dim)
converts cell array to structure array.
Here dim means dimensions . c means cell array.
Ex: >>c={‘tree’,37.4,’bamboo’};
f={‘catgeory’,’height’,’name’};
s=cell2struct(c,f,2)
s=
category : ’tree’
height : 37.4000
name : ‘bamboo’
Student . Name . first = ‘kusu’;
student.name . last = ‘kalyan’;
Student . score = 82.39;
Student . grade = ‘B’;
student(2).name . first = ‘Anna’;
student(2).name . last = ‘Tom’;
student(2).score = 94.50;
Student(3).name . first = ‘Jerry’
 The structure arrays can be accessed as :
Ex: >>student . score
ans=82.39
Student(1) score is also similar to that of student.
We can replace the contents of the student by
giving changed information.
Ex:>>student .grade=‘A’;
>>student . grade
ans=A
 By using MATLAB structure arrays can be created ,
accessed easily.
 MATLAB handles vector and matrices very nice . It
is an interpreted language.
 Quick plotting and analysis . It is an interactive
environment.
 Matrix based-handle and manipulate large data sets .
But it is slow compared to C or Java .
 If you want to learn Matlab Webtunix Solutions is one of the
best Artificial Intelligence Company in Chandigarh
who is working on Intelligent Web Frameworks Such as
MATLAB, Python, Hadoop, Big Data and Java.
 Here is the list of some companies which uses these MATLAB
Toolboxes and job roles offered by them:-
General Electric - (Job role)Controls Engineer
 Caterpillar - (Job role) Engineer - Model Based Developer
 Cyient - (Job role) System Engineer
Continental AG - (Job role) HIL Simulation Engineer
 Alstom Limited - (Job role) Control engineer
 Boeing International Corporation India Private
Limited - (Job role) Navigation and control engineer
 The MathWorks - (Job role) Automative system
engineer
 Satyam-Venture Engineering Services Private Limited
- (Job role) System modelling and system engineer
 Satyam-Venture Engineering Services Private Limited
- (Job role) Control engineer - Mechatronics
 ABB Group - Automation company - (Job role )
Domain test engineer
 DRDO - Defence Research and Development
Organization - (job role) Application support engineer
Structure Arrays

More Related Content

What's hot (20)

TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
Kruti Niranjan
 
OOP Assignment 03.pdf
OOP Assignment 03.pdf
ARSLANMEHMOOD47
 
Assemblies
Assemblies
Janas Khan
 
single linked list
single linked list
Sathasivam Rangasamy
 
C++ Programming
C++ Programming
Envision Computer Training Institute
 
Data Structures and Algorithms
Data Structures and Algorithms
Pierre Vigneras
 
Constants in java
Constants in java
Manojkumar C
 
Computer Graphics
Computer Graphics
Adri Jovin
 
Turing machines
Turing machines
surekamurali
 
Coupling and cohesion
Coupling and cohesion
Sutha31
 
Minimization of DFA
Minimization of DFA
kunj desai
 
Graph coloring using backtracking
Graph coloring using backtracking
shashidharPapishetty
 
Getters_And_Setters.pptx
Getters_And_Setters.pptx
Kavindu Sachinthe
 
backtracking algorithms of ada
backtracking algorithms of ada
Sahil Kumar
 
How to work on Matlab.......
How to work on Matlab.......
biinoida
 
Data Base Management System - Basic Structure of SQL Queries
Data Base Management System - Basic Structure of SQL Queries
jananisairam
 
Evaluation of prefix expression with example
Evaluation of prefix expression with example
GADAPURAMSAINIKHIL
 
Call by value or call by reference in C++
Call by value or call by reference in C++
Sachin Yadav
 
Stack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADT
Soumen Santra
 
Stacks Implementation and Examples
Stacks Implementation and Examples
greatqadirgee4u
 
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
Kruti Niranjan
 
Data Structures and Algorithms
Data Structures and Algorithms
Pierre Vigneras
 
Computer Graphics
Computer Graphics
Adri Jovin
 
Coupling and cohesion
Coupling and cohesion
Sutha31
 
Minimization of DFA
Minimization of DFA
kunj desai
 
backtracking algorithms of ada
backtracking algorithms of ada
Sahil Kumar
 
How to work on Matlab.......
How to work on Matlab.......
biinoida
 
Data Base Management System - Basic Structure of SQL Queries
Data Base Management System - Basic Structure of SQL Queries
jananisairam
 
Evaluation of prefix expression with example
Evaluation of prefix expression with example
GADAPURAMSAINIKHIL
 
Call by value or call by reference in C++
Call by value or call by reference in C++
Sachin Yadav
 
Stack and its Applications : Data Structures ADT
Stack and its Applications : Data Structures ADT
Soumen Santra
 
Stacks Implementation and Examples
Stacks Implementation and Examples
greatqadirgee4u
 

Similar to Structure Arrays (20)

Data Structures Notes 2021
Data Structures Notes 2021
Sreedhar Chowdam
 
Session2
Session2
daviessegera
 
Chapter2
Chapter2
Krishna Kumar
 
BEN520 FUNDAMENTALS OF BOENGINEERING II-4 week-lecture 4.pptx
BEN520 FUNDAMENTALS OF BOENGINEERING II-4 week-lecture 4.pptx
chemeng87
 
II B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptx
sabithabanu83
 
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
Central university of Haryana
 
Matlab-Data types and operators
Matlab-Data types and operators
Luckshay Batra
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
Aakash deep Singhal
 
PPT Lecture 2.2.1 onn c++ data structures
PPT Lecture 2.2.1 onn c++ data structures
midtushar
 
Introduction to Data Structure
Introduction to Data Structure
Kamal Singh Lodhi
 
all matlab_prog.pdf
all matlab_prog.pdf
Central university of Haryana
 
358 33 powerpoint-slides_5-arrays_chapter-5
358 33 powerpoint-slides_5-arrays_chapter-5
sumitbardhan
 
Data structures KTU chapter2.PPT
Data structures KTU chapter2.PPT
Albin562191
 
Lecture 2a arrays
Lecture 2a arrays
Victor Palmar
 
Introduction to Data Structures and their importance
Introduction to Data Structures and their importance
Bulbul Agrawal
 
The Stack in Data structure and algorithm
The Stack in Data structure and algorithm
SourajitMaity1
 
8074.pdf
8074.pdf
BAna36
 
Mbd dd
Mbd dd
Aditya Choudhury
 
Object Oriented Programming in Matlab
Object Oriented Programming in Matlab
AlbanLevy
 
Unit 4 cspc
Unit 4 cspc
BBDITM LUCKNOW
 
Data Structures Notes 2021
Data Structures Notes 2021
Sreedhar Chowdam
 
BEN520 FUNDAMENTALS OF BOENGINEERING II-4 week-lecture 4.pptx
BEN520 FUNDAMENTALS OF BOENGINEERING II-4 week-lecture 4.pptx
chemeng87
 
II B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptx
sabithabanu83
 
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
Central university of Haryana
 
Matlab-Data types and operators
Matlab-Data types and operators
Luckshay Batra
 
Lecture 1 data structures and algorithms
Lecture 1 data structures and algorithms
Aakash deep Singhal
 
PPT Lecture 2.2.1 onn c++ data structures
PPT Lecture 2.2.1 onn c++ data structures
midtushar
 
Introduction to Data Structure
Introduction to Data Structure
Kamal Singh Lodhi
 
358 33 powerpoint-slides_5-arrays_chapter-5
358 33 powerpoint-slides_5-arrays_chapter-5
sumitbardhan
 
Data structures KTU chapter2.PPT
Data structures KTU chapter2.PPT
Albin562191
 
Introduction to Data Structures and their importance
Introduction to Data Structures and their importance
Bulbul Agrawal
 
The Stack in Data structure and algorithm
The Stack in Data structure and algorithm
SourajitMaity1
 
8074.pdf
8074.pdf
BAna36
 
Object Oriented Programming in Matlab
Object Oriented Programming in Matlab
AlbanLevy
 
Ad

Recently uploaded (20)

How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Overview of Employee in Odoo 18 - Odoo Slides
Overview of Employee in Odoo 18 - Odoo Slides
Celine George
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Rajdeep Bavaliya
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
TechSoup
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
Vikas Bansal Himachal Pradesh: A Visionary Transforming Himachal’s Educationa...
Vikas Bansal Himachal Pradesh: A Visionary Transforming Himachal’s Educationa...
Himalayan Group of Professional Institutions (HGPI)
 
LDMMIA Spring Ending Guest Grad Student News
LDMMIA Spring Ending Guest Grad Student News
LDM & Mia eStudios
 
How to Manage Multi Language for Invoice in Odoo 18
How to Manage Multi Language for Invoice in Odoo 18
Celine George
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Chalukyas of Gujrat, Solanki Dynasty NEP.pptx
Chalukyas of Gujrat, Solanki Dynasty NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
How to Manage Inventory Movement in Odoo 18 POS
How to Manage Inventory Movement in Odoo 18 POS
Celine George
 
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 1 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Overview of Employee in Odoo 18 - Odoo Slides
Overview of Employee in Odoo 18 - Odoo Slides
Celine George
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Paper 109 | Archetypal Journeys in ‘Interstellar’: Exploring Universal Themes...
Rajdeep Bavaliya
 
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
SPENT QUIZ NQL JR FEST 5.0 BY SOURAV.pptx
Sourav Kr Podder
 
Black and White Illustrative Group Project Presentation.pdf (1).pdf
Black and White Illustrative Group Project Presentation.pdf (1).pdf
AnnasofiaUrsini
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
ABCs of Bookkeeping for Nonprofits TechSoup.pdf
TechSoup
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
LDMMIA Spring Ending Guest Grad Student News
LDMMIA Spring Ending Guest Grad Student News
LDM & Mia eStudios
 
How to Manage Multi Language for Invoice in Odoo 18
How to Manage Multi Language for Invoice in Odoo 18
Celine George
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
Ad

Structure Arrays

  • 2.  About MATLAB  Arrays  Types of arrays  Structure arrays  Creating structures  Structure functions  Program  Accessing structure arrays  Summary
  • 3.  MATLAB (matrix laboratory) is a fourth-generation high-level programming language and interactive environment for numerical computation.  MATLAB is widely used as a computational tool in science and engineering encompassing the fields of physics , chemistry, math and all engineering streams. It is a range of applications including: • Signal processing and communications • Control systems • Computational biology
  • 4.  It is started developing MATLAB in the late 1970s.  CLEVE MOLER , the chairman of the computer science department at the university of New Mexico .  Moler and Steve Bangert together rewrote MATLAB in ‘C’ and founded Math works in 1984 to continue its development. CLEVE MOLER STEVE BANGERT
  • 5.  One of the strength of MATLAB is the capability to handle collections of items , called ARRAYS ,as if they were a single entity.  The array-handling feature means that MATLAB programs can be very short.  The array is the basic building block in MATLAB.
  • 6.  Numeric array  Character array  Logical array  Cell array  Structure array  Function handle array  Java array
  • 7.  Structure arrays are composed of structures.  Numeric, character and cell arrays all reference the individual elements by number.  Structures reference individual elements within each row (called “fields”) by name.  To access these fields, the dot “.” notation is used.  Assignment is as follows: Structurename.Fieldname = datatype;
  • 8.  Let’s create a simple structure: >>Person . first name = ‘ramesh’; Person .Last name = ‘ babu ’; Person.Address1 = ‘china’; Person . city = ‘america’; Person . state = ‘US’; Person . Zip = ‘30332-0001
  • 9.  >>person= first name: ’Ramesh’ last name: ’Babu’ address1:’china’ city : ‘America’ state : ‘US’ Zip: ‘30332-0001’ By creating simple structure then type in command window person that will display above result i.e is related to person details . Person(1) also gives same information.
  • 10.  s= struct(‘f1’,’v1’,’f2’,’v2’,...) creates a structure array with the fields ‘f1’,’f2’,… having the values ‘v1’,’v2’,... Ex: >>s= struct(‘type’,{‘big’,’little’},’color’,’red’,’x’,{3 4}) s=1x2 struct array with the fields: type color x . .
  • 11.  names=fieldnames(s) Return the fields names associated with the structure array S as names , a cell array of strings. Ex: >>names=fieldnames(s) names=‘type’ ‘color’ ‘x’  isfield(s,’field’) returns 1 if ‘field’ is the name of a field in the structure array s and 0 otherwise.
  • 12. Ex: >>isfield(s,’field’) ans=0 >>isfield(s,{‘type’,’color’,’x’}) ans=1 1 1  isstruct(s) Returns 1 if the array s is a structure array and 0 otherwise Ex: >>isstruct(s) ans=1  s=rmfield(s,’field’) removes the field ‘field’ from the structure array s
  • 13.  Ex: >>s=rmfield(s,’type’) s=1x2 struct array with fields: color x These are the structure functions and there descriptions.
  • 14.  c=structure2cell(s) converts structure array to cell array. Ex: >>clear s, s.category=‘tree’;s.height=37.4; s.name=‘bamboo’; >>c=struct2cell(s) c= ‘tree’ [37.4000] ‘bamboo’ >>f=fieldnames(s) f=‘category’ ‘height’ ‘name’
  • 15.  s=cell2struct(c,fields,dim) converts cell array to structure array. Here dim means dimensions . c means cell array. Ex: >>c={‘tree’,37.4,’bamboo’}; f={‘catgeory’,’height’,’name’}; s=cell2struct(c,f,2) s= category : ’tree’ height : 37.4000 name : ‘bamboo’
  • 16. Student . Name . first = ‘kusu’; student.name . last = ‘kalyan’; Student . score = 82.39; Student . grade = ‘B’; student(2).name . first = ‘Anna’; student(2).name . last = ‘Tom’; student(2).score = 94.50; Student(3).name . first = ‘Jerry’
  • 17.  The structure arrays can be accessed as : Ex: >>student . score ans=82.39 Student(1) score is also similar to that of student. We can replace the contents of the student by giving changed information. Ex:>>student .grade=‘A’; >>student . grade ans=A
  • 18.  By using MATLAB structure arrays can be created , accessed easily.  MATLAB handles vector and matrices very nice . It is an interpreted language.  Quick plotting and analysis . It is an interactive environment.  Matrix based-handle and manipulate large data sets . But it is slow compared to C or Java .
  • 19.  If you want to learn Matlab Webtunix Solutions is one of the best Artificial Intelligence Company in Chandigarh who is working on Intelligent Web Frameworks Such as MATLAB, Python, Hadoop, Big Data and Java.  Here is the list of some companies which uses these MATLAB Toolboxes and job roles offered by them:- General Electric - (Job role)Controls Engineer  Caterpillar - (Job role) Engineer - Model Based Developer  Cyient - (Job role) System Engineer Continental AG - (Job role) HIL Simulation Engineer  Alstom Limited - (Job role) Control engineer
  • 20.  Boeing International Corporation India Private Limited - (Job role) Navigation and control engineer  The MathWorks - (Job role) Automative system engineer  Satyam-Venture Engineering Services Private Limited - (Job role) System modelling and system engineer  Satyam-Venture Engineering Services Private Limited - (Job role) Control engineer - Mechatronics  ABB Group - Automation company - (Job role ) Domain test engineer  DRDO - Defence Research and Development Organization - (job role) Application support engineer