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

5 次查看(过去 30 天)
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)];

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by