Create an array of two structures that represents two image and their sizes. my_
ID: 2082030 • Letter: C
Question
Create an array of two structures that represents two image and their sizes. my_images (1). imagename = 'Image 1'; my_images (1). width = 256; my_images (1). height = 256; my_images (2). imagename - 'Image 2'; my_image (2).width = 128; my_images (2) height = 128; How to view details about the structure? my_images(1) How to display details about the contents of a field? my_images (2) image name Some specific information about the structure: mum_of_image = prod (size(my_images)) fieldnames (my_images) What does the fieldnames function do? What does it mean when the result from the function isstruct is 1? What does it mean when it is 0? Use the help system to determine what function can be used to delete a field from a structureExplanation / Answer
Fieldnames defines names of the structure or public fields of an object.
names = fieldnames(x):
Here the fieldnames function returns a cell array of strings containing the structure field names associated with the structure x.
Isstruct
This function determines whether input is structure array.
If isstruct(my_images) returns logical 1 (true) then my_images is a MATLAB structure array.
If isstruct(my_images) returns logical0 (false) then my_images is not a MATLAB structure array.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.