필터 지우기
필터 지우기

how to get double from struct

조회 수: 34 (최근 30일)
Sivakumaran Chandrasekaran
Sivakumaran Chandrasekaran 2013년 12월 18일
답변: Image Analyst 2013년 12월 18일
how to get double from struct

답변 (1개)

Image Analyst
Image Analyst 2013년 12월 18일
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

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by