getting specific data out of struct (if statement error)

조회 수: 1 (최근 30일)
Timon Niedecken
Timon Niedecken 2018년 5월 19일
답변: Ameer Hamza 2018년 5월 19일
Hi there,
I am trying to get every Member of struct x with the type 'way' into one array. But i get an error Message 'Matrix dimensions must agree.' for my if-clause.
for i = 1:n
if ((x.osm.relation.member{1, i}.Attributes.type == 'way'))
ways(j) = x.osm.relation.member{1, i}.Attributes.ref;
j= j+1;
end
end

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 5월 19일
Use contains() or strfind() to compare char arrays or strings.
if contains(x.osm.relation.member{1, i}.Attributes.type, 'way')

추가 답변 (0개)

카테고리

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