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

5 visualizzazioni (ultimi 30 giorni)
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 Commenti
Stephen23
Stephen23 il 28 Lug 2017
Modificato: Stephen23 il 28 Lug 2017
Simplest solution: Use Notepad++ and its "Find in Files" operation and the "Replace with" option.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by