Structs Help on indexing
古いコメントを表示
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
2020 年 12 月 8 日
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
2020 年 12 月 8 日
Try something like this
city_name = 'Abidjan';
idx = contains({climate.info.name}, city_name);
city_data = climate.info(idx)
カテゴリ
ヘルプ センター および File Exchange で Structures についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!