How can I reduce the run time a code?
2 次查看(过去 30 天)
显示 更早的评论
Hi everybody,
I ran a code and controlled the run time of each script.
As you can see in Figure attachment, I realized that find command increase the run time.
How can I reduce this time?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1574762/image.jpeg)
0 个评论
回答(2 个)
madhan ravi
2023-12-22
移动:Matt J
2023-12-22
Directly use logical indexing , i.e: remove find(…) command and replace your if condition with
if any(index)
Try using ismember(…) instead of == , not sure which one is faster.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!