my code takes long time for execution and I tried 'profile' if ~exist('VarName') it takes 60,93sec tempName = strsplit(tmpRow); it takes 28,59sec how can I change these statements. so, that I can reduce the execution time?

2 件のコメント

madhan ravi
madhan ravi 2018 年 8 月 29 日
Will you post the whole code?
Jan
Jan 2018 年 8 月 29 日
@Sindh: It is impossible to suggest an improvement of your code, if you do not show it. There is no magic strsplit_but_faster command, so the only solution is to reduce the work. But without seeing the code, it is impossible to guess, how to help you.

サインインしてコメントする。

 採用された回答

Jan
Jan 2018 年 8 月 29 日

1 投票

~exist('VarName')
This is a very bad idea. Remember, that exist(s) searches the whole Matlab path for M files, other files, directories and Java classes with this name. In addition it checks for variables in the workspace also. Of course this wastes a lot of time.
Without seeing the context of this command, the purpose of this command is not clear. Guessing the intention is a rather bad idea. But if "VarName" is meant to be a name of a variable, use:
~exist('VarName', 'var')
But even then this might be a bad programming practice. If you post the relevant part of the code, better suggestions are possible.

1 件のコメント

Emma
Emma 2018 年 8 月 29 日
when compared to previous execution it has reduced thank u

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で File Operations についてさらに検索

質問済み:

2018 年 8 月 29 日

コメント済み:

2018 年 8 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by