Borrar filtros
Borrar filtros

how to get double from struct

34 visualizaciones (últimos 30 días)
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran el 18 de Dic. de 2013
Respondida: Image Analyst el 18 de Dic. de 2013
how to get double from struct

Respuestas (1)

Image Analyst
Image Analyst el 18 de Dic. de 2013
You have to refer to a field in the structure that you want to convert, if it even does need conversion, then use the proper function. Here's an example for 3 data types:
% Create the structure with 3 fields of different types.
s.anInteger = int32(42);
s.aString = '73';
s.aDouble = pi;
% Convert them to doubles.
d1 = double(s.anInteger)
d2 = str2double(s.aString)
d3 = s.aDouble
% Verify that they are actually doubles.
whos d1
whos d2
whos d3

Categorías

Más información sobre Structures en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by