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 comentarios

madhan ravi
madhan ravi el 29 de Ag. de 2018
Will you post the whole code?
Jan
Jan el 29 de Ag. de 2018
@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.

Iniciar sesión para comentar.

 Respuesta aceptada

Jan
Jan el 29 de Ag. de 2018
~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 comentario

Emma
Emma el 29 de Ag. de 2018
when compared to previous execution it has reduced thank u

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre File Operations en Centro de ayuda y File Exchange.

Preguntada:

el 29 de Ag. de 2018

Comentada:

el 29 de Ag. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by