- equal to "state"
- equal to "source"
- contains "lat"
- contains "lon"
- contains "timestamp"
- etc.
What does ix=ismember(vars,["state","source"])| contains(vars,["lat", "lon", "timestamp", "damage", "event"]); do?
3 次查看(过去 30 天)
显示 更早的评论
What does the code line
ix=ismember(vars,["state","source"])| contains(vars,["lat", "lon", "timestamp", "damage", "event"]);
in the Matlab Example https://ch.mathworks.com/de/videos/importing-your-data-into-matlab-1567682718882.html actually do?
As far as I understand, the ix of each row is 1 when "state" and "source" or ["lat", "lon", "timestamp", "damage", "event"] are in the vars-string. Is this correct?
1 个评论
Stephen23
2022-1-13
Where any element of vars is either:
the corresponding element of the output IX will be TRUE, otherwise the element will be FALSE.
采纳的回答
KSSV
2022-1-13
idx1=ismember(vars,["state","source"]) ; % gives logical indexing where state, source are presnt in vars
idx2 = contains(vars,["lat", "lon", "timestamp", "damage", "event"]); % gives logical indices where loat, lon etc are present in vats
ix = idx1 | idx2 ; % gives logical indexing of or of the above indices
6 个评论
Stephen23
2022-1-13
"Why are there two functions, which do the same thing?"
They don't do the same thing.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Function Creation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!