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

조회 수: 4 (최근 30일)
Dan Getz
Dan Getz 2017년 7월 28일
댓글: Dan Getz 2017년 7월 28일
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
Stephen23
Stephen23 2017년 7월 28일
편집: Stephen23 2017년 7월 28일
Simplest solution: Use Notepad++ and its "Find in Files" operation and the "Replace with" option.
Dan Getz
Dan Getz 2017년 7월 28일
I don't know why I didn't think of that. Genius thanks.

댓글을 달려면 로그인하십시오.

답변 (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