Is there a way to remove unnecessary square brackets from a script automatically?

5 visualizaciones (últimos 30 días)
I have a group of 20 or so scripts that I am trying to clean up and improve runtime performance. All of them have a similar error across about 30 or 40 lines per script. The code works, but I am getting this error message for each one. "Use of brackets [] is unnecessary. Use parenthesis to group, if needed." I can manually go through and remove them, but that's pretty tedious and I don't want to do it for all 20 scripts. Is there an existing function written that will automatically fix this so I don't have to manually correct this error?
Here is a sample of the code:
batt_day = [zeros(length(days),1)];
rain_day = [zeros(length(days),1)];
airT_day = [zeros(length(days),1)];
RH_avg_day = [zeros(length(days),1)];
WS_avg_day = [zeros(length(days),1)];
SlrCM_avg_day = [zeros(length(days),1)];
SlrMJ_tot_day = [zeros(length(days),1)];
tsoil6in_day = [zeros(length(days),1)];
tsoil1ft_day = [zeros(length(days),1)];
tsoil2ft_day = [zeros(length(days),1)];
tsoil3ft_day = [zeros(length(days),1)];
tsoil4ft_day = [zeros(length(days),1)];
  2 comentarios
Stephen23
Stephen23 el 28 de Jul. de 2017
Editada: Stephen23 el 28 de Jul. de 2017
Simplest solution: Use Notepad++ and its "Find in Files" operation and the "Replace with" option.
Dan Getz
Dan Getz el 28 de Jul. de 2017
I don't know why I didn't think of that. Genius thanks.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Shifting and Sorting Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by