Create an array containing numeric and symbolic variables

조회 수: 1 (최근 30일)
Connor LeClaire
Connor LeClaire 2021년 11월 24일
답변: Kevin Holly 2021년 11월 24일
I am trying to create an array that contains both numeric and symbolic variables. I need both as certain values will be tested if they are symbolic or not using isnumeric(); however, when trying to test these values they all come back as symbolic, is there a way around this? Code below:
syms t1 t2 d;
DH = [0 0.4 0 t1 %i = 1
0 0.1 -90 t2 %i = 2
0 d 90 0]; %i = 3
Thanks!

채택된 답변

Kevin Holly
Kevin Holly 2021년 11월 24일
syms t1 t2 d;
DH = {0 0.4 0 t1 %i = 1
0 0.1 -90 t2 %i = 2
0 d 90 0} %i = 3
DH = 3×4 cell array
{[0]} {[0.4000]} {[ 0]} {[t1]} {[0]} {[0.1000]} {[-90]} {[t2]} {[0]} {[d ]} {[ 90]} {[ 0]}
isnumeric(DH{1,1})
ans = logical
1
isnumeric(DH{1,4})
ans = logical
0

추가 답변 (0개)

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by