Как сделать видимым в матлаб воркспейс
Opening the Wor kspace Browser
To open the Workspace browser, select Workspace from the Desktop menu in the MATLAB desktop, or type workspace at the Command Window prompt.
The Workspace browser opens.
Viewing and Editing Values in the Current Workspace
The Workspace browser shows the name of each variable, its value, its array size, its size in bytes, and the class. The icon for each variable denotes its class.
To resize the columns of information, drag the column header borders. To show or hide any of the columns, or to specify the sort order, select View -> Choose Columns.
You can select the column on which to sort as well as reverse the sort order of any column. Click a column heading to sort on that column. Click the column heading again to reverse the sort order in that column. For example, to sort on Name, click the column heading once. To change from ascending to descending, click the heading again. You cannot sort by the Value column in the Workspace browser.
You can edit values directly in the Workspace browser Value column. To edit a value, select the row to change in the Value column and type in the new value.
Function Alternative
Use who to list the current workspace variables. Use whos to list the variables and information about their size and class. For example:
who Your variables are: A M S V whos Name Size Bytes Class A 1x4 32 double array M 3x1 202 cell array S 1x2 598 struct array V 1x35 70 char array Grand total is 76 elements using 902 bytes
Use exist to see if the specified variable is in the workspace.
| MATLAB Workspace | Saving the Current Workspace |
© 1994-2005 The MathWorks, Inc.
Clearing selected variables from MATLAB’s workspace in a performant way
I have a question regarding increasing the performance of clearing no longer required variables from MATLAB’s workspace. Assume that some variables are present in the workspace that shall be kept. Those variables can be stored as follows:
VarsToKeep = who
Also assume that after storing the variables, lots of new variables are generated. From time to time, I need to clear those newly generated variables which I currently do as follows:
eval(['clearvars -except ' cell2str(VarsToKeep,' ')]);
However, this operation seems to take quite long (more than 5s in my case). Since performance is a major issue in my environment, I would like to know whether there is a more performant MATLAB command for that operation.
64.6k 14 14 gold badges 83 83 silver badges 102 102 bronze badges
asked Jun 23, 2016 at 17:27
1,040 2 2 gold badges 17 17 silver badges 40 40 bronze badges
If you’re concerned about performance don’t use scripts or rely on the global workspace. Use functions with local workspaces in which temporary variables get cleaned up automatically.
Jun 23, 2016 at 17:40
@Suever Thanks for your reply. Unfortunately, in my case the framework is given.I have no influence about that.
Jun 23, 2016 at 17:53
There is no way to speed up clearvars unfortunately. Clearing memory takes time that is related to the amount of data being cleared.
Jun 23, 2016 at 17:53
I expected that there is no alternative to clearvars . However, could it be that my syntax is inefficient? I am not an MATLAB expert but I am wondering whether the eval or cell2str command is part of the problem?
Jun 23, 2016 at 18:02
Turn the profiler on profile viewer and you can see for yourself where the slowup is. Although eval is less than ideal it’s certainly not what’s causing your issues.
Jun 23, 2016 at 18:05
1 Answer 1
Rather than using eval you can simply use the function syntax () to call clearvars and pass your VarsToKeep to it using indexing to create a comma-separated list.
clearvars('-except', VarsToKeep);
As far as why it is slow, it really depends on how many variables that you are removing. If you have more variables it is going to take longer to clear.
Update
As you’ve stated in the comments, you have close to 500 variables that you are trying to prevent from being cleared. If we look at the internals of clearvars , there are a few reasons why specifying so many variables to exclude is slow.
Regular Expressions
Internally, clearvars creates a regular expression to determine which variables to keep. In your case, you have specified all of the variable names explicitly so it must concatenate them into a big regular expression.
If for example, we wanted to keep the variables A , B , and C , this regular expression would look something like:
And this regular expression basically only matches things that are not our variables of interest:
regexp(, '^(?!(A|B|C)$).'); % [] [1] [] [1] [] [1]
This regular expression is just passed to the built-in clear to do the actual clearing in the following way:
clear -regexp '^(?!(A|B|C)$).'
clear then has to go compare every variable to this regular expression to determine whether to remove it or not.
Now it’s important to remember that regular expressions aren’t the most computationally friendly thing and it only gets worse as they grow more and more complex. As you add variables to exclude, this regular expression keeps growing bigger. Also, this regular expression has to be evaluated for each variable in your workspace so things add up quickly.
Just as a proof of concept, if you had 25 variables of 25 characters each, the regex would look like this
^(?!(onhwbcwijwjjoxyowepmnjeac|jkowjywrerpfamjpdtcisttpy|qtaihttmztryenwyfdzhnunsw|fyhvhmybvbqulietxwitalcjd|noeszudvzieizcbvpraycicnt|gkhdpwticanasbjfyrgjytzlp|nfrrgwghhalhlzawaqtqzdxkd|ritwzxekjcctmyooeuoutufod|sfuimpzzcavgxyuhqhbrttrjn|zquelkgrexmgbogtzegyineay|qyjuxjkfkpnluafyownikibtv|xxoprkwzvrkkvcozvvlhhlaft|nkvuoaxsiztuixtbmmbdaoijb|hdsdopqyndjsbuvefvkcxzohl|pzlitikbyysnpwewzraiifmgi|zfucjwulrnzluxqyohsdmophc|gbdiiftvfbsqoregmmzpemadw|rjdfzlznmshxpvbvqhcwhsuud|ekbluwjwevpgsjbnqjvzybxul|jfmgqyvomuhprelxnolizptxn|iyhnvmdyvrenfhpsmfawqvqga|jcfbtajkidnimopxmawzblfmq|yyccqfoftjqmcbeainaeweeyk|jelyftqgcqkepnpyzdkrpqpam|mbucicotugqiksqkpgryhzwev)$).
If you want to benchmark how long just the regular expression part takes, you can do the following:
% Construct a regular expression of all of your variables regex = sprintf('^(?!(%s)$).', strjoin(VarsToKeep, '|')); % Now match all variables to this regex. matches = regexp(VarsToKeep, regex);
This explains why even if you are keeping all variables in your workspace it’s still terribly slow, because MATLAB still has to construct this giant regular expression and compare it to every variable only to find that you excluded all of them.
Note that this is just the overhead that doesn’t actually include clearing the underlying data.
An Alternative
Rather than using all of this regular expression matching, it will likely be faster to get a list of variables before and after you run your code, then use setdiff or ismember to determine the ones that were added and then clear these explicitly with clear .
% Keep track of the variables before we started beforeVars = who; % Do stuff % Get the list of variables after we're done afterVars = who; % Figure out which ones were added toRemove = afterVars(~ismember(afterVars, beforeVars)); % Now clear these variables explicitly (no regular expressions involved) clear(toRemove)
This is still going to take a long time if you have large variables defined in your workspace, but at least you aren’t wasting much time identifying which variables to remove.
A Benchmark for Good Measure
I was actually curious what kind of performance I got, so I designed a quick little benchmark to do the test. Essentially I create N variables in the global workspace (with random names of a specific length) and assign them all a random scalar value (they shouldn’t take any time to clear). Then I apply the two methodologies for removing half of them.
function testclear % Range of sizes to test (I don't have all day so I only tested 5) nVars = round(linspace(1, 500, 5)); times1 = zeros(1, numel(nVars)); times2 = zeros(1, numel(nVars)); for n = 1:numel(nVars) %% TEST THE CLEARVARS WAY % Now create twice as many variables (we will clear half) createVariables(2 * nVars(n)); % Now we're going to clear half the variables and time it tic evalin('base', 'clearvars(''-except'', W<1:ceil(numel(W)/2)>)'); times1(n) = toc; % Now clear everything for the next run evalin('base', 'clear(W)'); %% EXPLICITLY PASS TO CLEAR createVariables(2 * nVars(n)); evalin('base', 'beforeVars = W(1:ceil(numel(W)/2));') evalin('base', 'afterVars = W((ceil(numel(W)/2) + 1):end);') tic evalin('base', 'toRemove = afterVars(~ismember(afterVars, beforeVars));'); evalin('base', 'clear(toRemove);') times2(n) = toc; % Now clear everything for the next run evalin('base', 'clear(W)'); end figure; plot(nVars, times1, nVars, times2); xlabel('Number of Variables to Keep') ylabel('Execution Time (sec)') legend(); end function createVariables(N) for k = 1:N % Create a random variable name varname = randsample('a':'z', 25, 1); % Assign that variable within the workspace evalin('base', [varname, '= rand(1);']); end % Get a list of all variables evalin('base', 'W=who;'); % Add 'W' to the list so it doesn't get cleared evalin('base', 'W = [''W''; W];'); end
Well. I think this graph speaks for itself on which is faster.
I ran a similar test like you proposed where all variables were in the -except list and it yielded similar results.
Документация
Когда вы запускаете MATLAB ® , рабочий стол появляется в своей раскладке по умолчанию.

По умолчанию рабочий стол включает эти инструменты:
По умолчанию панель инструментов включает три вкладки, Home, Plots и Apps.
Просмотрите и измените текущую папку.
Управляйте файлами и папками в MATLAB. Действия включают просмотр, создание, открытие, перемещение и переименование файлов и папок в текущей папке.
Просмотрите и управляйте содержимым рабочей области в MATLAB.
Введите отдельные операторы в командной строке и просмотрите получившийся вывод.
В MATLAB Online™ и в системах с более низким разрешением экрана, значениями по умолчанию MATLAB к размещению 2D столбца с браузером Рабочей области на левой стороне рабочего стола, под Браузером текущей папки.
Чтобы изменить структуру рабочего стола, можно выбрать из набора предварительно сконфигурированных структур рабочего стола, или можно создать собственное размещение путем сокрытия, минимизировав, и расстыковать отдельные инструменты. Также можно изменить размещение документов в инструменте путем расстыковки, переупорядочив или разместив их рядом. Затем можно сохранить размещения и снова использовать их снова в более позднее время.
Выберите Preconfigured Layout
MATLAB обеспечивает набор предварительно сконфигурированных структур рабочего стола, которые оптимизированы для определенных рабочих процессов. Чтобы выбрать предварительно сконфигурированное размещение, на вкладке Home, в разделе Environment, нажимают Layout и выбирают размещение. Чтобы восстановить рабочий стол MATLAB к его раскладке по умолчанию, выберите Default.
Например, если вы работаете в основном в Командном окне, выбираете опцию All but Command Window Minimized (Minimize All but Command Window в MATLAB Online ), чтобы максимизировать Командное окно и минимизировать все другие инструменты в рабочем столе.

Скройте инструменты
Чтобы скрыть инструмент, нажмите кнопку в строке заголовка инструмента и выберите Close. Чтобы скрыть только строку заголовка для инструмента, на вкладке Home, в разделе Environment, нажимают Layout. Затем в разделе Show очистите Panel Titles.
В MATLAB Online не поддерживается сокрытие инструментов. Чтобы оптимизировать вашу структуру рабочего стола, минимизируйте инструменты вместо этого.
Минимизируйте инструменты
Минимизируйте инструменты в рабочем столе, чтобы оптимизировать размещение при тихом поддержании быстрого доступа к инструментам, которые вы периодически используете.
Чтобы минимизировать панель инструментов, в правом нижнем углу панели инструментов, нажимают кнопку. Панель инструментов минимизирует, но вкладки остаются видимыми. Чтобы восстановить панель инструментов, выберите одну из вкладок, чтобы отобразить панель инструментов, и затем, в правом нижнем углу панели инструментов, нажать кнопку.

Чтобы минимизировать другие инструменты включая Браузер текущей папки, Командное окно, Редактор, и Live Editor, в строке заголовка инструмента, нажимает кнопку и выбирает Minimize. Минимизированный инструмент появляется вдоль ребра рабочего стола, показанного стрелкой в Минимизировать значке. Например, минимизировать значок указывает, что инструмент минимизирует к правому краю рабочего стола по умолчанию. Чтобы переместить минимизированный инструмент в другой край рабочего стола, перетащите инструменты к желаемому местоположению.
Например, чтобы минимизировать Браузер текущей папки, в правом верхнем углу Браузера текущей папки, нажимают кнопку и выбирают Minimize. Браузер текущей папки минимизирует к левой стороне экрана.

Чтобы открыть минимизированный инструмент временно на рабочем столе, кликните по инструменту. Чтобы восстановить инструмент к его первоначальному размеру, дважды щелкают по инструменту. В качестве альтернативы можно нажать кнопку и выбрать Restore.
В MATLAB Online , чтобы минимизировать инструмент, сворачивают панель, где инструмент находится. Например, если рабочий стол MATLAB Online находится в раскладке по умолчанию с Браузером текущей папки в левой панели, скройте Браузер текущей папки путем нажатия кнопки в левом нижнем углу панели. Чтобы восстановить его, нажмите кнопку. Если левая или правая панель содержит несколько инструментов, можно минимизировать отдельный инструмент путем нажатия кнопки слева от ее строки заголовка. Несколько инструментов в нижнем отображении панели как вкладки и не могут быть минимизированы.
Открытые инструменты
Чтобы открыть инструменты, которые вы ранее скрыли, на вкладке Home, в разделе Environment, нажимают Layout. Затем в разделе Show выберите настольный инструмент, который вы хотите показать на рабочем столе.
Также можно открыть некоторые инструменты программно с помощью функции. Например, чтобы открыть Редактор, используйте edit функция. Чтобы открыть браузер Рабочей области, используйте workspace функция.
Расстыкуйте инструменты и документы
Расстыкуйте инструменты, чтобы открыть их в отдельном окне и переместить их вне рабочего стола MATLAB. Чтобы расстыковать инструмент, в строке заголовка прикрепленного инструмента, нажимают кнопку и выбирают Undock. В качестве альтернативы перетащите инструмент его строкой заголовка к новому местоположению за пределами рабочего стола MATLAB. Чтобы положить обратно расстыкованный инструмент в рабочий стол, в верхнем правом углу расстыкованного инструмента, нажимают кнопку и выбирают Dock.
Также можно расстыковать отдельные документы в инструменте, такие как отдельный файл скрипта, открытый в Редакторе. Чтобы расстыковать отдельный документ, щелкните правой кнопкой по документу, переходят и выбирают Undock. В качестве альтернативы можно нажать кнопку в строке заголовка инструмента и выбрать Undock document .
Например, если у вас есть файл fact.m открытый в Редакторе, чтобы расстыковать только, что файл, в строке заголовка Редактора, нажимает кнопку и выбирает Undock fact.m. MATLAB открывает fact.m в отдельном окне и листах Редактор, прикрепленный в рабочем столе. Чтобы положить обратно файл в рабочий стол, в правом верхнем из расстыкованного файла, нажимают кнопку и выбирают Dock. Если вы имеете несколько расстыкованных документов и хотите переместить их всех назад в рабочий стол, выберите Dock All in tool .

Расстыкованные инструменты и документы появляются на Windows ® панель задач или эквивалент для вашей платформы. Кликните по значку панели задач для инструмента или документа, чтобы сделать его активным.
Расстыковка инструментов и документов не поддерживается в MATLAB Online .
Переупорядочивание и документы мозаики
Когда вы открываете документы MATLAB, они открываются в связанном инструменте, таком как Редактор, Live Editor или редактор Переменных. Отдельные документы открываются как отдельные вкладки в инструменте. Чтобы оптимизировать размещение нескольких документов, можно переупорядочить или разместить их рядом. Также можно измениться, где вкладки появляются в инструменте.
По умолчанию вкладки появляются наверху документа. Чтобы переупорядочить отдельные вкладки документа в инструменте, перетащите вкладки к различной позиции. Чтобы переупорядочить вкладки документа в алфавитном порядке, на вкладке View, в разделе Document Tabs, выбирают Alphabetize.
Чтобы сменить положение вкладок в инструменте, на вкладке View, нажимают Tabs Position и выбор из доступных параметров. Например, чтобы отобразить вкладки на стороне Редактора вместо наверху, с открытым Редактором, переходят к вкладке View, нажимают Tabs Position и выбирают Left. MATLAB отображает вкладки Редактора левой стороны инструмента.


Чтобы просмотреть несколько документов целиком в инструменте, можно разместить документы рядом. К документам мозаики в Редакторе Live Editor и редактор Переменных, переходят к вкладке View и в разделе Tiles, выбирают опцию мозаики. Например, чтобы просмотреть два файла рядом друг с другом в Редакторе, перейдите к вкладке View и нажмите кнопку Left/Right.

Чтобы переместить мозаичный документ, перетащите вкладку документа к другой мозаике. Если вы перетаскиваете его к мозаике, которая уже содержит документ, документ, который вы перетаскиваете, покрывает другой документ.
К документам мозаики в панели фигуры Браузер документации или веб-браузер, на правой стороне строки заголовка инструмента, выбирает , или переключатель.
В MATLAB Online , к документам мозаики, в строке заголовка инструмента, нажимают кнопку, выбирают Tile All, и затем выбирают опцию мозаики.
Сохраните структуры рабочего стола
Когда вы заканчиваете сеанс, MATLAB сохраняет текущую структуру рабочего стола. Следующий раз, когда вы запускаете MATLAB, рабочий стол, появляется, когда вы оставили его.
Если вы чередуетесь между двумя или больше индивидуально настраиваемыми структурами рабочего стола, можно сохранить их всех, чтобы легко переключиться между ними. Чтобы сохранить размещение, на вкладке Home, в разделе Environment, нажимают Layout и выбирают Save Layout. Чтобы использовать сохраненное размещение, на вкладке Home, нажимают Layout и выбирают ваше сохраненное размещение. Чтобы удалить или переименовать сохраненные размещения, выберите Manage Layouts.
MATLAB хранит все сохраненные размещения в папке настроек. MATLAB сохраняет текущую структуру рабочего стола в конце сеанса в файле MATLABDesktop.xml .
Некоторые инструменты, такие как Браузер документации, веб-браузер, и редактор Переменных, не вновь открылись автоматически, даже если они были открыты, когда вы закончили последний сеанс. Можно использовать опции запуска, чтобы задать инструменты, которые вы хотите открыть на запуске. Для получения дополнительной информации смотрите, Задают опции запуска.
Сохранение размещений и определение опций запуска не поддерживаются в MATLAB Online .
Смотрите также
Похожие темы
- Настройте панели инструментов MATLAB
- Измените настольные шрифты
- Измените настольные цвета
Customizing Workspace context-menu
My first article of 2010 described customizing Matlab’s Workspace table, in particular the values presented in the Bytes column.
Last week, a reader of that article posted a comment asking how to customize the context (right-click) menu with some user-defined actions. The user has found that modifying the menu via the regular table handles gets reset automatically.
Today’s article will describe an easy and effective way to add user-defined actions to the Workspace table, for specific object types.
The trick is not to modify the context-menu directly. As the reader above has noticed, this menu is automatically recreated on the fly, so no change will be persistent. Instead, we modify Matlab’s internal registry of class-specific context-menus. This is done in several prefspanel.m files in the Matlab codebase (For example: \toolbox\matlab\audiovideo\prefspanel.m and \toolbox\signal\signal\prefspanel.m).
The mechanism relies on the following Java method, which is unsupported and undocumented, yet has existed in the present form for the past several releases:
classes = {'double', 'java.lang.Object'}; menuName = 'My context-menu'; menuItems = {'Inspect', 'Properties', '-', 'class name'}; menuActions = {'inspect($1)', 'get($1)', '', 'class($1)'}; com.mathworks.mlwidgets.workspace.MatlabCustomClassRegistry.registerClassCallbacks(classes,menuName,menuItems,menuActions);
classes = ; menuName = ‘My context-menu’; menuItems = ; menuActions = ; com.mathworks.mlwidgets.workspace.MatlabCustomClassRegistry.registerClassCallbacks(classes,menuName,menuItems,menuActions);

Once you have found your particular context-menu configuration useful, place the short customization code in your startup.m file so that the change becomes permanent in all future Matlab sessions.
A few other supporting static methods are available in the com.mathworks.mlwidgets.workspace.MatlabCustomClassRegistry class: getClassCallbacksInformation (className), registerSimilarClassCallbacks(newClassNames,definedClassName) and unregisterClassCallbacks(definedClassName). For example:
com.mathworks.mlwidgets.workspace.MatlabCustomClassRegistry.getClassCallbacksInformation('double') ans = java.lang.Object[]: 'My context-menu' [4 element array] % = menuItems [4 element array] % = menuActions
com.mathworks.mlwidgets.workspace.MatlabCustomClassRegistry.getClassCallbacksInformation(‘double’) ans = java.lang.Object[]: ‘My context-menu’ [4 element array] % = menuItems [4 element array] % = menuActions
Related posts:
- Customizing Matlab’s Workspace table – The Matlab Desktop’s Workspace pane table can be customized, as described here.
- PlotEdit context-menu customization – A combination of Matlab and Java Robot commands to automate a certain animation can be used when we cannot access underlying GUI/graphics code. .
- Adding a context-menu to a uitree – uitree is an undocumented Matlab function, which does not easily enable setting a context-menu. Here’s how to do it.
- Customizing uiundo – This article describes how Matlab’s undocumented uiundo undo/redo manager can be customized.
- Customizing help popup contents – The built-in HelpPopup, available since Matlab R2007b, has a back-door that enables displaying arbitrary text, HTML and URL web-pages.
- Context-Sensitive Help – Matlab has a hidden/unsupported built-in mechanism for easy implementation of context-sensitive help.
19 Responses
Donn Shull November 4, 2010 at 10:07 Reply It may be worth noting for people developing toolboxes that at startup MATLAB searches the path for prefspanel.m and executes them. An alternative location for context-menu configurations is in your own prefspanel.m file. Thanks Yair
Mike L November 7, 2010 at 13:13 Reply Works like a charm! I’m amazed so much of the underlying machinery is exposed and how straightforwardly you were able to go ahead and play with it. Thanks, Yair!
Yair Altman November 7, 2010 at 14:46 Reply Thanks Mike – it may look straightforward when I present it (which is exactly my purpose), but believe me when I say that each of these seemingly simple posts is the result of many hours of research, trial-and-error, tests, blind-alleys etc….
Bluesmaster March 7, 2013 at 10:02 Reply is this also possible for the “current folder” component?
I would like to add an entry for tortoise svn commit for single files best regards Bluesmaster
Yair Altman March 7, 2013 at 10:10 Reply @Bluesmaster – I don’t think so. There’s probably a similar mechanism somewhere else, but I don’t think it’s under com.mathworks.mlwidgets.workspace.* . Then again, I never checked so maybe it is… Let us all know if you discover anything interesting.
Bluesmaster March 7, 2013 at 10:18 hm too bad. And what about a workaround? Maybe a button in the “current folder” toolbar?
They also have to know which file is selected e.g. for creating a new folder into the selected one. Do you have an idea? Thanks
Yair Altman March 7, 2013 at 11:04 @Bluemaster – I never tried this but I’m sure this is also possible. I showed how to customize the Desktop toolbar in section 8.1.4 of my Matlab-Java book, and you could start from there.
com.mathworks.mde.explorer.Explorer.getInstance.getComponents com.mathworks.mde.explorer.Explorer.getInstance.getTable
Got some questions/ advices: – what about a diff-tool in findjobj (like regshot), return of investment could be reached in days – what about a small search line in findjobj ( popup( ‘class’ , ‘property’ …) | searchstring) – copying classnames to clipboard could also be usefull (lost an hour by a typing error ) – how to get informations about com.mathworks.* without having an entity? (just had luck, that I “discovered” .getInstance) sorry for the big amount of text, and best regards Bluesmaster
Yair Altman March 9, 2013 at 16:55 Reply I think you may be trying to turn findjobj into a lot more than it was intended for… For a diff tool, try my objdiff utility. For the object classname, simply copy the object to the workspace (using one of the right-click context menu options) and then run the class function on it (class(h)) For basic information about a class you could use either my checkClass utility or my uiinspect utility. For documentation on the internal classes, read my Matlab-Java book.
Bluesmaster March 10, 2013 at 01:53 “I think you may be trying to turn findjobj into a lot more than it was intended for…” …that is possible, but I thought gathering ideas is never a bad idea. objdiff is great, but it doesn’t support recursion ( ? ) so it does not suite for the purpose of “Checking a checkbox and find out the corresponding java-obj that changed”.
That’s what I meant about “Return of investment”, cause I thought your work is a lot about investigation ( of course today you seem to know the most things, but some newcomers like me maybe not ) Thanks for your help Bluesmaster
Bluesmaster March 12, 2013 at 07:02 Reply Hello Yair, I need a small advice. I got access to the currentfileBrowser. It is a JideSoft TreeTable (i think) cfb = com.mathworks.mde.explorer.Explorer.getInstance.getTable I searched for hours, but i cant find a way to customize a cells style (icon/ background…)
You have a lot of experience with the jide-Tools can you tell me how to to do that if I got lets say this item: cfb.getItem(0) That would help me so much. best regards Bluesmaster
Yair Altman March 12, 2013 at 14:29 Reply @Bluesmaster – Answering your query is non-trivial and goes beyond what I can provide in a simple comment here. You should read either my book or my uitable report as a starting point. I can also help you customize your GUI as a consultant if you wish.
CrisPi June 14, 2013 at 06:30 Reply Hi,
great and super useful article, but I ran into a bit of a problem – the classes ‘single’ and ‘double’ only work when they are not complex (Matlab 2013a). I haven’t had any luck finding the appropriate class name for the complex case (e.g. ‘complex single’) – could you please help me out?
Thanks, Chris
Malcolm Lidierth June 14, 2013 at 18:05 Reply @CrisPi Complex numbers do not have a special type: a complex number is stored as two numbers representing its real and imaginary types, so e.g
>> i ans = 0 + 1.0000i >> isreal(imag(i)) ans = true
Yair Altman June 15, 2013 at 12:19 Reply @CrisPi – all you need to do is to add the class which is specified in the Workspace’s Class column (in this case, ‘double (complex)’ or ‘single (complex)’ ), and then restart Matlab. As easy as that… …and similarly for any user defined or third-party class…
classes = {'double', 'single', 'double (complex)', 'single (complex)', 'java.lang.Object', 'com.mathworks.mde.desk.MLDesktop'}; .
CrisPi August 20, 2013 at 07:55 Reply Thanks so much Yair, that worked – I was looking at the Value column, not the Class one. But on a related note: Is it also possible to define a command for multiple choices? ie selecting two, and then the command is executed on both of them (or they are combined, like it’s done for the plot(var1,var2) possibility)…
Lex July 26, 2017 at 10:16 Reply Thank you, Yair! I use Matlab 2017a and make menu for Java class ‘java.lang.Object’. But this menu item appears only for this class and don’t take inheritance into account. Can I make menu item for all Java variables?
MatthieuC April 23, 2018 at 15:06 Reply Hello !
Is there an equivalent for the “Current Folder” context-menu?
I know the package is com.mathworks.mlwidgets.explorer but I cannot handle the way of adding context-menu with it. Thanks
MatthieuC April 24, 2018 at 14:26 Reply To give more detail about my question… I would add some Subversion specific actions on Right-Click (for instance, setting working copy depth commands).
Thank you for your help.
Leave a Reply
HTML tags such as or are accepted.
Wrap code fragments inside tags, like this:
a = magic(3);
disp(sum(a))I reserve the right to edit/delete comments (read the site policies).
Not all comments will be answered. You can always email me (altmany at gmail) for private consulting.Useful links
- Email Yair Altman
- Subscribe to new posts (feed)
- Subscribe to new posts (reader)
- Subscribe to comments (feed)
var addthis_pub="altmany";var addthis_language = 'en';var addthis_options = 'email, favorites, facebook, google, digg, delicious, myspace, reddit, live, more'; -->
