How to access struct values

2 visualizaciones (últimos 30 días)
Vaibhav Lakhanpal
Vaibhav Lakhanpal el 29 de Sept. de 2017
Respondida: OCDER el 29 de Sept. de 2017
I am using Phill Salee's jpeg toolbox. Link http://dde.binghamton.edu/download/jpeg_toolbox.zip
im=jpeg_read('baboon.jpg')
im =
image_width: 512
image_height: 512
image_components: 3
image_color_space: 2
jpeg_components: 3
jpeg_color_space: 3
comments: {}
coef_arrays: {[512x512 double] [256x256 double] [256x256 double]}
quant_tables: {[8x8 double] [8x8 double]}
ac_huff_tables: [1x2 struct]
dc_huff_tables: [1x2 struct]
optimize_coding: 0
comp_info: [1x3 struct]
progressive_mode: 0
When I run the line given below I get "Reference to non-existent field 'coef_arraysim'" error!
Xy = im.coef_arraysim.comp_info(1).component_id ;
How do I get the type of output shown below? The below shown output is for some other image and not baboon.jpeg.
>> whos Xy
Name Size Bytes Class Attributes
Xy 248x184 365056 double

Respuesta aceptada

OCDER
OCDER el 29 de Sept. de 2017
There is no coef_arraysim field in im, hence the error message.
I do see something close, coef_arrays, which stores 3 double matrices. To access one of the double matrix within im.coef_arrays, do this:
Xy = im.coef_arrays{N} %where N is 1, 2, or 3

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by