I have a struct with 7 feilds called climate.info
one of the feilds is City, and withing this feild there are hundreds of cities and the climate at certain times.
Therefore there are hundreds of entries of the same city at different times.
Is it possible to get the values of all the times of only that one specific city.

댓글 수: 2

Hassan Hijazi
Hassan Hijazi 2020년 12월 8일
This is an example of the struct, and I want all the data values that are only for the city of abidjan
Walter Roberson
Walter Roberson 2020년 12월 8일
Is climate.info.City a struct array ("hundreds of entries") that has fields that give the city name and fields that give the climate information ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 12월 8일

0 개 추천

Try something like this
city_name = 'Abidjan';
idx = contains({climate.info.name}, city_name);
city_data = climate.info(idx)

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

제품

태그

질문:

2020년 12월 8일

답변:

2020년 12월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by