필터 지우기
필터 지우기

[MATLAB's GUI] Erase everything within "Delimiter matching"

조회 수: 5 (최근 30일)
Luciano Branco
Luciano Branco 2024년 8월 1일
댓글: Luciano Branco 2024년 8월 4일
Hello,
After coming across this post,
I improved a lot my Matlab experience by better seeing the scope of a function, it's arguments, parenthesis, etc. It's great.
However, I was wondering if there is a way to setup a hotkey to remove the contents that are highlighthed by such delimiters. I couldn't find anything online.
In other words, if Matlab is properly highlighting these delimiters (i.e. parenthesis, brackets, IF/END, etc) there must be a way to capture these 2 "endpoints" and just erase everything within it. Maybe some Java hacks which I'm not super familiar with?
I'm using Matlab 2020b and have no intention of changing it anytime soon (because I have custom libraries that stopped being supported) if that changes anything.
Thanks for any input!
Luciano

채택된 답변

Mario Malic
Mario Malic 2024년 8월 1일
Hello,
this answer comes with a big warning, because I accidentally deleted the script, but I managed to recover it. So, 100% not recommended thing to do, as it's undocumented and also, you're risking to lose your code. If your editor loses focus, it will be saved and you can't undo.
Because I don't think this is something that should be posted because of users potentially losing the code, let's discuss your problem first.
Can you elaborate on this, why would you do this, what are you trying to fix - In other words, if Matlab is properly highlighting these delimiters (i.e. parenthesis, brackets, IF/END, etc) there must be a way to capture these 2 "endpoints" and just erase everything within it.
  댓글 수: 3
Mario Malic
Mario Malic 2024년 8월 3일
Sorry for the delay.
Check this
doc matlab.desktop.editor
Get the opened file in editor
openedDoc = matlab.desktop.editor.getActive
So, you are looking for Selection and Text property. With these you can figure out how to delete parts of code.
Unfortunately, I didn't find any information, how to obtain the underlined text, i.e. when you click on "if" and the editor will underline the "end".
Luciano Branco
Luciano Branco 2024년 8월 4일
Thanks, for the help. I would need the underlined text for this project but I imagined that's hard to find.
Cheers,
LB

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by