Clear Workspace keyboard shortcut no longer works from within Editor in R2022a?

25 ビュー (過去 30 日間)
Matthew McMahon
Matthew McMahon 2022 年 8 月 3 日
コメント済み: Matthew McMahon 2022 年 8 月 25 日
Since time immemorial, when setting up a new version of MATLAB one of the first things I do is set the Ctrl-L keyboard shortcut for clc, and the Ctrl-Shift-A shortcut for "clear all". I just started working with R2022a and it seems that I can no longer clear the workspace using my Ctrl-Shift-A shortcut if I am within an Editor window (for instance, advancing through cells in Cell Mode). I'm certain I've been able to do this in every version up to this point. At present, I can only perform the shortcut if the cursor is in the Command Window. This is terribly frustrating.
Has anyone else encountered this behavior?
  1 件のコメント
Matthew McMahon
Matthew McMahon 2022 年 8 月 25 日
I have confirmed that my custom shortcut works from the Editor window as recently as R2020b.

サインインしてコメントする。

回答 (2 件)

Mandar
Mandar 2022 年 8 月 18 日
This might be due to the conflicts with other functionalities in the recent version of MATLAB. Use the unassigned keyboard mapping, for eg. 'ctrl+shift+j', to clear the workspace from the editor window in MATLAB 2022a. Alternatievely, the user interace of MATLAB 2022a has an option to clear the workspace under the 'Home' tab with the name 'Clear Workspace'.
To explore more on how to customize the keyboard shortcuts refer the link below.
  • link: https://www.mathworks.com/help/matlab/matlab_env/keyboard-shortcuts.html#:~:text=MATLAB%20displays%20the%20keyboard%20shortcuts,Editor%20is%20the%20Escape%20key.
  4 件のコメント
Matthew McMahon
Matthew McMahon 2022 年 8 月 18 日
Please see my answer below...

サインインしてコメントする。


Image Analyst
Image Analyst 2022 年 8 月 18 日
We have seen that sometimes the control key combinations quit working:
We don't know why or when or how to fix except by restarting MATLAB. Perhaps you're experiencing the same bug.
The way I do it is to create a shortcut on the Quick Access Toolbar in the upper right that says "Clean up". The code for it looks like this:
% Initializes everything
close all force;
clear all;
clear global;
status = fclose('all');
clc;
% Close down Variable Editor windows.
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
Titles = desktop.getClientTitles;
for k = 1:numel(Titles)
Client = desktop.getClient(Titles(k));
if ~isempty(Client) & ...
strcmp(char(Client.getClass.getName), 'com.mathworks.mde.array.ArrayEditor')
Client.close();
end
end
clear('desktop', 'k', 'Titles', 'Client', 'status');
  2 件のコメント
Matthew McMahon
Matthew McMahon 2022 年 8 月 18 日
Thanks, I'll try this. However, it doesn't seem to be the case that it's a random error or that it's affecting any other shortcuts. My custom shortcut works fine when I'm outside the Editor window.
Matthew McMahon
Matthew McMahon 2022 年 8 月 18 日
I have restarted MATLAB several times and reproduced the behavior. Oddly, my Ctrl-L shortcut for clc works just fine from the Editor window.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by