Tag Archives: matlab
To obtain initializations in generated code(Embedded Coder) for each “Control input” of a variant subsystem inside a library
Hello team,
I am facing one issue in the generated code of a Variant Subsystem used inside a library.
Since the library has been used for multiple instances, with different control inputs for the variant subsystem (implemented inside a library), the generated code is expected to have definitions for each of the control input based on the instance used for that particular variant subsystem.
I am able to achieve this for one default value though the other control input definitions are not shown in the generated code. I am sharing the respective code snapshot for your reference. Requesting your support to achieve expected and required definitions in the generated code.
Please guide me if there is any applicable setting or similar update is required to achieve the desired results.Hello team,
I am facing one issue in the generated code of a Variant Subsystem used inside a library.
Since the library has been used for multiple instances, with different control inputs for the variant subsystem (implemented inside a library), the generated code is expected to have definitions for each of the control input based on the instance used for that particular variant subsystem.
I am able to achieve this for one default value though the other control input definitions are not shown in the generated code. I am sharing the respective code snapshot for your reference. Requesting your support to achieve expected and required definitions in the generated code.
Please guide me if there is any applicable setting or similar update is required to achieve the desired results. Hello team,
I am facing one issue in the generated code of a Variant Subsystem used inside a library.
Since the library has been used for multiple instances, with different control inputs for the variant subsystem (implemented inside a library), the generated code is expected to have definitions for each of the control input based on the instance used for that particular variant subsystem.
I am able to achieve this for one default value though the other control input definitions are not shown in the generated code. I am sharing the respective code snapshot for your reference. Requesting your support to achieve expected and required definitions in the generated code.
Please guide me if there is any applicable setting or similar update is required to achieve the desired results. code generation, variant subsystem MATLAB Answers — New Questions
Interaction Effects Reference Coding
Hi there,
I read the summary on fitlme (https://de.mathworks.com/help/stats/fitlme.html). I am having a question regarding the reference coding.
In the example "Longitudinal Study with a covariate" the effect of Prorgam B is significant indicating a stronger effect of B than A. I want to confirm that my understanding of interaction effects is correct. If for example Program B: Week would have been significant, that would mean that the effects of weeks is different under Programm B compared to A (and not compared to all other programs?)
Thank you!Hi there,
I read the summary on fitlme (https://de.mathworks.com/help/stats/fitlme.html). I am having a question regarding the reference coding.
In the example "Longitudinal Study with a covariate" the effect of Prorgam B is significant indicating a stronger effect of B than A. I want to confirm that my understanding of interaction effects is correct. If for example Program B: Week would have been significant, that would mean that the effects of weeks is different under Programm B compared to A (and not compared to all other programs?)
Thank you! Hi there,
I read the summary on fitlme (https://de.mathworks.com/help/stats/fitlme.html). I am having a question regarding the reference coding.
In the example "Longitudinal Study with a covariate" the effect of Prorgam B is significant indicating a stronger effect of B than A. I want to confirm that my understanding of interaction effects is correct. If for example Program B: Week would have been significant, that would mean that the effects of weeks is different under Programm B compared to A (and not compared to all other programs?)
Thank you! interaction, lme MATLAB Answers — New Questions
Java Robot – Unable to perform SHIFT-RIGHT
I’m trying to use the Java robot to do a page-right command which, in the program in I’m trying to use it for, can be performed with a SHIFT-RIGHT keyboard input. This is essentialy the code I’m using:
import java.awt.*
import java.awt.event.*
rob=Robot;
rob.keyPress(KeyEvent.VK_SHIFT)
rob.keyPress(KeyEvent.VK_RIGHT)
rob.keyRelease(KeyEvent.VK_RIGHT)
rob.keyRelease(KeyEvent.VK_SHIFT)
However, when running the code, the shift key is pressed but appears to essentially be released before the right arrow is pressed, so I only get a single movement to the right instead of a page-right. Replacing VK_RIGHT with VK_A will correctly type an uppercase A as expected, so there seems to be some issue with combining the SHIFT key with non-character keys. I tried adding an autoDelay and adding long pauses between key events, but it didn’t fix the issue.
I can of course program it to press the right arrow multiple times, but that’s messier and slower and involves an extra step where I have to determine how many right arrow presses it takes to do a page-right.
Any ideas what I can do?I’m trying to use the Java robot to do a page-right command which, in the program in I’m trying to use it for, can be performed with a SHIFT-RIGHT keyboard input. This is essentialy the code I’m using:
import java.awt.*
import java.awt.event.*
rob=Robot;
rob.keyPress(KeyEvent.VK_SHIFT)
rob.keyPress(KeyEvent.VK_RIGHT)
rob.keyRelease(KeyEvent.VK_RIGHT)
rob.keyRelease(KeyEvent.VK_SHIFT)
However, when running the code, the shift key is pressed but appears to essentially be released before the right arrow is pressed, so I only get a single movement to the right instead of a page-right. Replacing VK_RIGHT with VK_A will correctly type an uppercase A as expected, so there seems to be some issue with combining the SHIFT key with non-character keys. I tried adding an autoDelay and adding long pauses between key events, but it didn’t fix the issue.
I can of course program it to press the right arrow multiple times, but that’s messier and slower and involves an extra step where I have to determine how many right arrow presses it takes to do a page-right.
Any ideas what I can do? I’m trying to use the Java robot to do a page-right command which, in the program in I’m trying to use it for, can be performed with a SHIFT-RIGHT keyboard input. This is essentialy the code I’m using:
import java.awt.*
import java.awt.event.*
rob=Robot;
rob.keyPress(KeyEvent.VK_SHIFT)
rob.keyPress(KeyEvent.VK_RIGHT)
rob.keyRelease(KeyEvent.VK_RIGHT)
rob.keyRelease(KeyEvent.VK_SHIFT)
However, when running the code, the shift key is pressed but appears to essentially be released before the right arrow is pressed, so I only get a single movement to the right instead of a page-right. Replacing VK_RIGHT with VK_A will correctly type an uppercase A as expected, so there seems to be some issue with combining the SHIFT key with non-character keys. I tried adding an autoDelay and adding long pauses between key events, but it didn’t fix the issue.
I can of course program it to press the right arrow multiple times, but that’s messier and slower and involves an extra step where I have to determine how many right arrow presses it takes to do a page-right.
Any ideas what I can do? java, robot MATLAB Answers — New Questions
Image is displaying in different axes
Hi, I have a problem dispalying an image in a certain axes(axes4, btw). Everytime I click a certain option in the pop-up menu/list it always displays in axes5(additionally, it always displays on axes that are newly added or created, in my instance its axes5). Please do help Hoiw I do this.
Here is my code snippet…..
% — Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,’String’)) returns popupmenu2 contents as cell array
% contents{get(hObject,’Value’)} returns selected item from popupmenu2
str = get(hObject, ‘String’);
val = get(hObject, ‘Value’);
% set current filter to the user-selected filter
switch str{val};
case ‘RED’
a = imread(‘C:UsersVinsMATLAB_SAMPLE_FolderMatlabcontrast.jpeg’);
b = imagesc(a(:,:,1));
image(handles.axes4, b)
axis(handles.axes4, ‘image’, ‘off’);
case ‘BLUE’
case ‘GREEN’
endHi, I have a problem dispalying an image in a certain axes(axes4, btw). Everytime I click a certain option in the pop-up menu/list it always displays in axes5(additionally, it always displays on axes that are newly added or created, in my instance its axes5). Please do help Hoiw I do this.
Here is my code snippet…..
% — Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,’String’)) returns popupmenu2 contents as cell array
% contents{get(hObject,’Value’)} returns selected item from popupmenu2
str = get(hObject, ‘String’);
val = get(hObject, ‘Value’);
% set current filter to the user-selected filter
switch str{val};
case ‘RED’
a = imread(‘C:UsersVinsMATLAB_SAMPLE_FolderMatlabcontrast.jpeg’);
b = imagesc(a(:,:,1));
image(handles.axes4, b)
axis(handles.axes4, ‘image’, ‘off’);
case ‘BLUE’
case ‘GREEN’
end Hi, I have a problem dispalying an image in a certain axes(axes4, btw). Everytime I click a certain option in the pop-up menu/list it always displays in axes5(additionally, it always displays on axes that are newly added or created, in my instance its axes5). Please do help Hoiw I do this.
Here is my code snippet…..
% — Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,’String’)) returns popupmenu2 contents as cell array
% contents{get(hObject,’Value’)} returns selected item from popupmenu2
str = get(hObject, ‘String’);
val = get(hObject, ‘Value’);
% set current filter to the user-selected filter
switch str{val};
case ‘RED’
a = imread(‘C:UsersVinsMATLAB_SAMPLE_FolderMatlabcontrast.jpeg’);
b = imagesc(a(:,:,1));
image(handles.axes4, b)
axis(handles.axes4, ‘image’, ‘off’);
case ‘BLUE’
case ‘GREEN’
end image processing, axes, guide, matlab gui MATLAB Answers — New Questions
*.mdl extension in library file is giving error in 2024a version
We were using lib.mdl file for cusomised library of our tool in simulink and it was working fine till 2023b version but in 2024a and 2024b version it is giving me error saying the lib file has to be in .slx extension what is the exact reason to this?
error image:
whether .mdl extension for libraries is deprecated or not, we are in a confusion please provide us a accurate reason for this issue.We were using lib.mdl file for cusomised library of our tool in simulink and it was working fine till 2023b version but in 2024a and 2024b version it is giving me error saying the lib file has to be in .slx extension what is the exact reason to this?
error image:
whether .mdl extension for libraries is deprecated or not, we are in a confusion please provide us a accurate reason for this issue. We were using lib.mdl file for cusomised library of our tool in simulink and it was working fine till 2023b version but in 2024a and 2024b version it is giving me error saying the lib file has to be in .slx extension what is the exact reason to this?
error image:
whether .mdl extension for libraries is deprecated or not, we are in a confusion please provide us a accurate reason for this issue. library file issue MATLAB Answers — New Questions
How to change flow direction in simscape
How can I create a port in a constant volume block in MATLAB Simscape (using the MA domain) that is oriented 90 degrees to the flow direction? Please provide recommendations.How can I create a port in a constant volume block in MATLAB Simscape (using the MA domain) that is oriented 90 degrees to the flow direction? Please provide recommendations. How can I create a port in a constant volume block in MATLAB Simscape (using the MA domain) that is oriented 90 degrees to the flow direction? Please provide recommendations. flow change, simscape MATLAB Answers — New Questions
Input/Output parameters of DLL
Hello everyone,
I am trying to generate a simple dll file from a simulink model. Basically the model takes an input, multiplies by two and puts it into an output. So I have created a matlab function in simulink such as this:
function y = fcn(u)
y = 2*u;
Now I want to generate the .dll file by using embedded coder. So I select ‘Shared library’, select the subsystem in simulink and click in embedded coder -> Generate subsystem. As a result I get a lot of files and mainly important the file multiply2.c Looking at the code I can see:
/* Model step function */
void multiply20_step(void)
{
/* Outport: ‘<Root>/y’ incorporates:
* Inport: ‘<Root>/u’
* MATLAB Function: ‘<Root>/multiply2’
*/
multiply20_Y.y = 2.0 * multiply20_U.signal1;
}
The .dll file is also generated properly. The thing is that I want to use this .dll in other program and to use it I need to use a function with inputs and ouputs to be able to call the dll. So I am trying to generate the C files and the .dll such that this function is something like this:
int multiply20_step(int)
{
The rest of the code.
}
I want this to be able to call this function with input parameters. I think that it migth have something to do with the Code generation/Interface parameters or maybe with the ‘Code Interface’ but I wasn’t able yet to solve it.
Could someone help me please. Thanks in advance.Hello everyone,
I am trying to generate a simple dll file from a simulink model. Basically the model takes an input, multiplies by two and puts it into an output. So I have created a matlab function in simulink such as this:
function y = fcn(u)
y = 2*u;
Now I want to generate the .dll file by using embedded coder. So I select ‘Shared library’, select the subsystem in simulink and click in embedded coder -> Generate subsystem. As a result I get a lot of files and mainly important the file multiply2.c Looking at the code I can see:
/* Model step function */
void multiply20_step(void)
{
/* Outport: ‘<Root>/y’ incorporates:
* Inport: ‘<Root>/u’
* MATLAB Function: ‘<Root>/multiply2’
*/
multiply20_Y.y = 2.0 * multiply20_U.signal1;
}
The .dll file is also generated properly. The thing is that I want to use this .dll in other program and to use it I need to use a function with inputs and ouputs to be able to call the dll. So I am trying to generate the C files and the .dll such that this function is something like this:
int multiply20_step(int)
{
The rest of the code.
}
I want this to be able to call this function with input parameters. I think that it migth have something to do with the Code generation/Interface parameters or maybe with the ‘Code Interface’ but I wasn’t able yet to solve it.
Could someone help me please. Thanks in advance. Hello everyone,
I am trying to generate a simple dll file from a simulink model. Basically the model takes an input, multiplies by two and puts it into an output. So I have created a matlab function in simulink such as this:
function y = fcn(u)
y = 2*u;
Now I want to generate the .dll file by using embedded coder. So I select ‘Shared library’, select the subsystem in simulink and click in embedded coder -> Generate subsystem. As a result I get a lot of files and mainly important the file multiply2.c Looking at the code I can see:
/* Model step function */
void multiply20_step(void)
{
/* Outport: ‘<Root>/y’ incorporates:
* Inport: ‘<Root>/u’
* MATLAB Function: ‘<Root>/multiply2’
*/
multiply20_Y.y = 2.0 * multiply20_U.signal1;
}
The .dll file is also generated properly. The thing is that I want to use this .dll in other program and to use it I need to use a function with inputs and ouputs to be able to call the dll. So I am trying to generate the C files and the .dll such that this function is something like this:
int multiply20_step(int)
{
The rest of the code.
}
I want this to be able to call this function with input parameters. I think that it migth have something to do with the Code generation/Interface parameters or maybe with the ‘Code Interface’ but I wasn’t able yet to solve it.
Could someone help me please. Thanks in advance. embedded coder, simulink, dll files MATLAB Answers — New Questions
How to find variable strings within a structure?
Hi! I have a workspace variable named ‘simulation’ which houses 6 fields. These fields have a varying number of fields within them. Is it possible to search every ‘branch’ of this ‘simulation’ structure to find string values that contain ‘.m’?
For example, to find that:
simulation.system{1, 1}.system{1, 1}.system{1, 1}.initialization{1, 1}.name
contains the string ‘drv_ctrl_look_ahead_init.m’Hi! I have a workspace variable named ‘simulation’ which houses 6 fields. These fields have a varying number of fields within them. Is it possible to search every ‘branch’ of this ‘simulation’ structure to find string values that contain ‘.m’?
For example, to find that:
simulation.system{1, 1}.system{1, 1}.system{1, 1}.initialization{1, 1}.name
contains the string ‘drv_ctrl_look_ahead_init.m’ Hi! I have a workspace variable named ‘simulation’ which houses 6 fields. These fields have a varying number of fields within them. Is it possible to search every ‘branch’ of this ‘simulation’ structure to find string values that contain ‘.m’?
For example, to find that:
simulation.system{1, 1}.system{1, 1}.system{1, 1}.initialization{1, 1}.name
contains the string ‘drv_ctrl_look_ahead_init.m’ structure, index, search MATLAB Answers — New Questions
Compact way to plot multiple listdlg items depending on user input.
I want to find a way to write a compact script that requests user input on a listdlg box and plots a graph depending on the parameters chosen (could be multiple parameters). I am relatively new to matlab and I want to write a generalized condition instead of hard-coding all possible combinations and plotting the outcome. I want to be able to plot up to 6 parameters in one graph with a compact code instead of writing the conditions 6!=6x5x4x3x2x1=720 times :/. To get a feel of my code:
list={‘Live data’,’Historic data’};
[type,tf] = listdlg(‘ListString’,list);
if type==1
list_title={‘a’,’b’,’c’};
[Topic_ID,tf] = listdlg(‘ListString’,list_title);
if 1 >= Topic_ID <= 3
list_var={‘NO2′,’CO’,’SO2′,’H2S’,’humidity’,’temperature’};
[var_pos,tf] = listdlg(‘PromptString’,’Select a variable to plot:’,’ListString’, list_var);
var_size=size(var_pos);
if var_pos==1 %Plot only NO2
figure(1)
t=datenum(datetime,’yyyy-mm-ddTHH:MM:SS.FFF’);
plot(t,NO2)
datetick(‘x’,’dd-mmm-yyyy HH:MM:SS’,’keepticks’,’keeplimits’);
xlabel(‘Time (dd-mmm-yyyy HH:MM:SS)’);
ylabel(‘NO2 (ppb)’);
title(‘NO2’);
legend(‘NO2’);
end
if isequal(var_pos,[1,2]) %Plot CO and NO2
figure(7)
t=datenum(datetime,’yyyy-mm-ddTHH:MM:SS.FFF’);
plot(t,NO2,t,CO)
datetick(‘x’,’dd-mmm-yyyy HH:MM:SS’,’keepticks’,’keeplimits’);
xlabel(‘Time (dd-mmm-yyyy HH:MM:SS)’);
ylabel(‘CO & NO2 (ppb)’);
title(‘CO & NO2’);
legend(‘NO2′,’CO’);
end
Where var_pos is the matrix that contains which list items were chosen. Appreciate any help. I can’t figure it out.I want to find a way to write a compact script that requests user input on a listdlg box and plots a graph depending on the parameters chosen (could be multiple parameters). I am relatively new to matlab and I want to write a generalized condition instead of hard-coding all possible combinations and plotting the outcome. I want to be able to plot up to 6 parameters in one graph with a compact code instead of writing the conditions 6!=6x5x4x3x2x1=720 times :/. To get a feel of my code:
list={‘Live data’,’Historic data’};
[type,tf] = listdlg(‘ListString’,list);
if type==1
list_title={‘a’,’b’,’c’};
[Topic_ID,tf] = listdlg(‘ListString’,list_title);
if 1 >= Topic_ID <= 3
list_var={‘NO2′,’CO’,’SO2′,’H2S’,’humidity’,’temperature’};
[var_pos,tf] = listdlg(‘PromptString’,’Select a variable to plot:’,’ListString’, list_var);
var_size=size(var_pos);
if var_pos==1 %Plot only NO2
figure(1)
t=datenum(datetime,’yyyy-mm-ddTHH:MM:SS.FFF’);
plot(t,NO2)
datetick(‘x’,’dd-mmm-yyyy HH:MM:SS’,’keepticks’,’keeplimits’);
xlabel(‘Time (dd-mmm-yyyy HH:MM:SS)’);
ylabel(‘NO2 (ppb)’);
title(‘NO2’);
legend(‘NO2’);
end
if isequal(var_pos,[1,2]) %Plot CO and NO2
figure(7)
t=datenum(datetime,’yyyy-mm-ddTHH:MM:SS.FFF’);
plot(t,NO2,t,CO)
datetick(‘x’,’dd-mmm-yyyy HH:MM:SS’,’keepticks’,’keeplimits’);
xlabel(‘Time (dd-mmm-yyyy HH:MM:SS)’);
ylabel(‘CO & NO2 (ppb)’);
title(‘CO & NO2’);
legend(‘NO2′,’CO’);
end
Where var_pos is the matrix that contains which list items were chosen. Appreciate any help. I can’t figure it out. I want to find a way to write a compact script that requests user input on a listdlg box and plots a graph depending on the parameters chosen (could be multiple parameters). I am relatively new to matlab and I want to write a generalized condition instead of hard-coding all possible combinations and plotting the outcome. I want to be able to plot up to 6 parameters in one graph with a compact code instead of writing the conditions 6!=6x5x4x3x2x1=720 times :/. To get a feel of my code:
list={‘Live data’,’Historic data’};
[type,tf] = listdlg(‘ListString’,list);
if type==1
list_title={‘a’,’b’,’c’};
[Topic_ID,tf] = listdlg(‘ListString’,list_title);
if 1 >= Topic_ID <= 3
list_var={‘NO2′,’CO’,’SO2′,’H2S’,’humidity’,’temperature’};
[var_pos,tf] = listdlg(‘PromptString’,’Select a variable to plot:’,’ListString’, list_var);
var_size=size(var_pos);
if var_pos==1 %Plot only NO2
figure(1)
t=datenum(datetime,’yyyy-mm-ddTHH:MM:SS.FFF’);
plot(t,NO2)
datetick(‘x’,’dd-mmm-yyyy HH:MM:SS’,’keepticks’,’keeplimits’);
xlabel(‘Time (dd-mmm-yyyy HH:MM:SS)’);
ylabel(‘NO2 (ppb)’);
title(‘NO2’);
legend(‘NO2’);
end
if isequal(var_pos,[1,2]) %Plot CO and NO2
figure(7)
t=datenum(datetime,’yyyy-mm-ddTHH:MM:SS.FFF’);
plot(t,NO2,t,CO)
datetick(‘x’,’dd-mmm-yyyy HH:MM:SS’,’keepticks’,’keeplimits’);
xlabel(‘Time (dd-mmm-yyyy HH:MM:SS)’);
ylabel(‘CO & NO2 (ppb)’);
title(‘CO & NO2’);
legend(‘NO2′,’CO’);
end
Where var_pos is the matrix that contains which list items were chosen. Appreciate any help. I can’t figure it out. listdlg, multiple plots MATLAB Answers — New Questions
Which Gaussian fitting tool should I use?
I used a gaussian fitting function that generated this result. Surely this graph can look more gaussian rather than parabolic?
I also tried using fit() from the curve fitting toolbox which gave me a straight line. What could be going wrong?
Here is the data:
% x
Columns 1 through 8
-16 -15 -14 -13 -12 -11 -10 -9
Columns 9 through 16
-8 -7 -6 -5 -4 -3 -2 -1
Columns 17 through 24
0 1 2 3 4 5 6 7
Columns 25 through 32
8 9 10 11 12 13 14 15
% y
Columns 1 through 8
79 85 87 84 77 92 84 88
Columns 9 through 16
93 88 90 98 99 133 164 183
Columns 17 through 24
180 134 107 92 86 85 85 79
Columns 25 through 32
94 85 90 82 93 83 102 8I used a gaussian fitting function that generated this result. Surely this graph can look more gaussian rather than parabolic?
I also tried using fit() from the curve fitting toolbox which gave me a straight line. What could be going wrong?
Here is the data:
% x
Columns 1 through 8
-16 -15 -14 -13 -12 -11 -10 -9
Columns 9 through 16
-8 -7 -6 -5 -4 -3 -2 -1
Columns 17 through 24
0 1 2 3 4 5 6 7
Columns 25 through 32
8 9 10 11 12 13 14 15
% y
Columns 1 through 8
79 85 87 84 77 92 84 88
Columns 9 through 16
93 88 90 98 99 133 164 183
Columns 17 through 24
180 134 107 92 86 85 85 79
Columns 25 through 32
94 85 90 82 93 83 102 8 I used a gaussian fitting function that generated this result. Surely this graph can look more gaussian rather than parabolic?
I also tried using fit() from the curve fitting toolbox which gave me a straight line. What could be going wrong?
Here is the data:
% x
Columns 1 through 8
-16 -15 -14 -13 -12 -11 -10 -9
Columns 9 through 16
-8 -7 -6 -5 -4 -3 -2 -1
Columns 17 through 24
0 1 2 3 4 5 6 7
Columns 25 through 32
8 9 10 11 12 13 14 15
% y
Columns 1 through 8
79 85 87 84 77 92 84 88
Columns 9 through 16
93 88 90 98 99 133 164 183
Columns 17 through 24
180 134 107 92 86 85 85 79
Columns 25 through 32
94 85 90 82 93 83 102 8 curve fitting, gaussian, fit MATLAB Answers — New Questions
Group K-fold partitioning a dataset
The scikit-learn package in Python has a <http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GroupKFold.html Group K-Fold> function that allows you to split the data-set into test/train folds while ensuring the same "group" is not present in different folds.
This is useful for example in studies where the same subject/person generates multiple data-points and we want to make sure the samples/data-points belonging to the same subject don’t appear in both the training and testing folds.
I was wondering if MATLAB has a way to do this or enable this option in <https://www.mathworks.com/help/stats/cvpartition.html cvpartition> function or in some other way. The default options only seem to preserve relative class-sizes.The scikit-learn package in Python has a <http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GroupKFold.html Group K-Fold> function that allows you to split the data-set into test/train folds while ensuring the same "group" is not present in different folds.
This is useful for example in studies where the same subject/person generates multiple data-points and we want to make sure the samples/data-points belonging to the same subject don’t appear in both the training and testing folds.
I was wondering if MATLAB has a way to do this or enable this option in <https://www.mathworks.com/help/stats/cvpartition.html cvpartition> function or in some other way. The default options only seem to preserve relative class-sizes. The scikit-learn package in Python has a <http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GroupKFold.html Group K-Fold> function that allows you to split the data-set into test/train folds while ensuring the same "group" is not present in different folds.
This is useful for example in studies where the same subject/person generates multiple data-points and we want to make sure the samples/data-points belonging to the same subject don’t appear in both the training and testing folds.
I was wondering if MATLAB has a way to do this or enable this option in <https://www.mathworks.com/help/stats/cvpartition.html cvpartition> function or in some other way. The default options only seem to preserve relative class-sizes. classification, machine learning, cvpartition MATLAB Answers — New Questions
A confusing problem about how to use boxLabelDatastore correctly
I don’t know how to deal with this issue and have tried to modify it several times, so I’m requesting someone who sees it to teach me.
thank you so much !!!I don’t know how to deal with this issue and have tried to modify it several times, so I’m requesting someone who sees it to teach me.
thank you so much !!! I don’t know how to deal with this issue and have tried to modify it several times, so I’m requesting someone who sees it to teach me.
thank you so much !!! formatting MATLAB Answers — New Questions
How to select engine variant in powertrain blockset
I want to work on 1.5 L naturally aspirated mapped engine whereas the default engine variant is 1.5L turbocharged engine how do i change my engine variantI want to work on 1.5 L naturally aspirated mapped engine whereas the default engine variant is 1.5L turbocharged engine how do i change my engine variant I want to work on 1.5 L naturally aspirated mapped engine whereas the default engine variant is 1.5L turbocharged engine how do i change my engine variant powertrain blockset, engine variant selection MATLAB Answers — New Questions
Sum two different coverage models
Is there a way to sum two different coverage outputs? I have two different transmitters and have plotted the output of each on the same coverage map. I notice that it appears to do the equivalent of a ‘max hold’ where the field patterns from the separate transmitters overlap. Is there a way to sum the field patterns from the separate transmitters? I realise that this would effectively assume zero phase diference at all points of interaction, but that suits what I am aiming to do.
So far I have tried converting the output of the coverage .Data to an array. This provides the lat, long, and dB output for each transmitter. What I can’t work out is how to sum these arrays when the lat and long values are different (as the transmitters are in different locations). In an ideal world, I would then convert the summed arrays back into a coverage map of the result.
Any help much appreciated.
% horn antenna setup
tx_horn = horn("Height", 0.06, "Width", 0.16, "Length", 0.10, "FeedHeight", …
0.04, "FeedWidth", 0.002, "FlareHeight", 0.216, "FlareLength", 0.15, …
"FlareWidth", 0.266);
% transmitter array setup
f = 1.3e9; % Frequency
c = 299792458; % Speed of light
wl = c / f; % Wavelength
M = 2; % Number of elements on each row
N = 2; % Number of elements on each column
dy = 0.5 * wl; % Spacing between row elements (m)
dz = 0.5 * wl; % Spacing between column elements (m)
ura = phased.URA([N M], [dz dy], ‘Element’, tx_horn);
% transmitter setup
tx1 = txsite(‘Latitude’, 52.36364, …
‘Longitude’, -3.77767, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
tx2 = txsite(‘Latitude’, 52.36369, …
‘Longitude’, -3.78150, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
% coverage output
e_max = -20;
e_min = -60;
e_step = 1;
cov1 = coverage(tx1, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
cov2 = coverage(tx2, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
% convert to arrays for summing?
tx_array1 = table2array(cov1.Data);
tx_array2 = table2array(cov2.Data);
% What next?Is there a way to sum two different coverage outputs? I have two different transmitters and have plotted the output of each on the same coverage map. I notice that it appears to do the equivalent of a ‘max hold’ where the field patterns from the separate transmitters overlap. Is there a way to sum the field patterns from the separate transmitters? I realise that this would effectively assume zero phase diference at all points of interaction, but that suits what I am aiming to do.
So far I have tried converting the output of the coverage .Data to an array. This provides the lat, long, and dB output for each transmitter. What I can’t work out is how to sum these arrays when the lat and long values are different (as the transmitters are in different locations). In an ideal world, I would then convert the summed arrays back into a coverage map of the result.
Any help much appreciated.
% horn antenna setup
tx_horn = horn("Height", 0.06, "Width", 0.16, "Length", 0.10, "FeedHeight", …
0.04, "FeedWidth", 0.002, "FlareHeight", 0.216, "FlareLength", 0.15, …
"FlareWidth", 0.266);
% transmitter array setup
f = 1.3e9; % Frequency
c = 299792458; % Speed of light
wl = c / f; % Wavelength
M = 2; % Number of elements on each row
N = 2; % Number of elements on each column
dy = 0.5 * wl; % Spacing between row elements (m)
dz = 0.5 * wl; % Spacing between column elements (m)
ura = phased.URA([N M], [dz dy], ‘Element’, tx_horn);
% transmitter setup
tx1 = txsite(‘Latitude’, 52.36364, …
‘Longitude’, -3.77767, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
tx2 = txsite(‘Latitude’, 52.36369, …
‘Longitude’, -3.78150, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
% coverage output
e_max = -20;
e_min = -60;
e_step = 1;
cov1 = coverage(tx1, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
cov2 = coverage(tx2, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
% convert to arrays for summing?
tx_array1 = table2array(cov1.Data);
tx_array2 = table2array(cov2.Data);
% What next? Is there a way to sum two different coverage outputs? I have two different transmitters and have plotted the output of each on the same coverage map. I notice that it appears to do the equivalent of a ‘max hold’ where the field patterns from the separate transmitters overlap. Is there a way to sum the field patterns from the separate transmitters? I realise that this would effectively assume zero phase diference at all points of interaction, but that suits what I am aiming to do.
So far I have tried converting the output of the coverage .Data to an array. This provides the lat, long, and dB output for each transmitter. What I can’t work out is how to sum these arrays when the lat and long values are different (as the transmitters are in different locations). In an ideal world, I would then convert the summed arrays back into a coverage map of the result.
Any help much appreciated.
% horn antenna setup
tx_horn = horn("Height", 0.06, "Width", 0.16, "Length", 0.10, "FeedHeight", …
0.04, "FeedWidth", 0.002, "FlareHeight", 0.216, "FlareLength", 0.15, …
"FlareWidth", 0.266);
% transmitter array setup
f = 1.3e9; % Frequency
c = 299792458; % Speed of light
wl = c / f; % Wavelength
M = 2; % Number of elements on each row
N = 2; % Number of elements on each column
dy = 0.5 * wl; % Spacing between row elements (m)
dz = 0.5 * wl; % Spacing between column elements (m)
ura = phased.URA([N M], [dz dy], ‘Element’, tx_horn);
% transmitter setup
tx1 = txsite(‘Latitude’, 52.36364, …
‘Longitude’, -3.77767, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
tx2 = txsite(‘Latitude’, 52.36369, …
‘Longitude’, -3.78150, …
‘TransmitterFrequency’, f, …
‘Antenna’, ura, …
‘AntennaHeight’, 5, …
‘TransmitterPower’, 50, …
‘AntennaAngle’, 90);
% coverage output
e_max = -20;
e_min = -60;
e_step = 1;
cov1 = coverage(tx1, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
cov2 = coverage(tx2, ‘close-in’, ‘SignalStrengths’, e_min:e_step:e_max, ‘ColorLimits’, [e_min e_max]);
% convert to arrays for summing?
tx_array1 = table2array(cov1.Data);
tx_array2 = table2array(cov2.Data);
% What next? coverage, sum, matlab MATLAB Answers — New Questions
compiler.runtime.customInstaller fails to reduce mcr installer size
I have a matlab toolbox, with a single-window GUI. I was able to build it mcc/deploytool to create a standalone 7MB executable. However, I was not happy for the installer size, as the R2016 matlab runtime is 700MB in size, 100x larger than my application.
When I saw a new matlab compiler API compiler.runtime.custominstaller coming with R2024b is cable of creating smaller MCR installer including only needed files, I was very happy and immediately tried it on free mod apk games website, however, the result was disappointing.
The installer bundled with MCR in R2024b for my app build by deploytool – without using the customInstaller – is 1.2GB in size (another 2x increase in size compared to the already large package generated by R2016). Then, when I called
results = compiler.build.standaloneApplication("myapp.m");
compiler.runtime.customInstaller("myapp_installer", results, ‘RuntimeDelivery’, ‘installer’);
however, the generated package has the same 1.2GB in size. I have followed the help page of compiler.runtime.customInstaller
https://www.mathworks.com/help/compiler/compiler.runtime.custominstaller.html
did I miss anything? why customInstaller fails to trim the installer size? my app only use basic matlab features.
the requiredMCRProducts.txt file shows that I only need the following MCR components
‘MATLAB Runtime – Core’
‘MATLAB Runtime – Graphics’
‘MATLAB Runtime – Non Interactive MATLAB’
‘MATLAB Runtime – Numerics’
‘MATLAB Runtime – Image Processing Toolbox Addin’I have a matlab toolbox, with a single-window GUI. I was able to build it mcc/deploytool to create a standalone 7MB executable. However, I was not happy for the installer size, as the R2016 matlab runtime is 700MB in size, 100x larger than my application.
When I saw a new matlab compiler API compiler.runtime.custominstaller coming with R2024b is cable of creating smaller MCR installer including only needed files, I was very happy and immediately tried it on free mod apk games website, however, the result was disappointing.
The installer bundled with MCR in R2024b for my app build by deploytool – without using the customInstaller – is 1.2GB in size (another 2x increase in size compared to the already large package generated by R2016). Then, when I called
results = compiler.build.standaloneApplication("myapp.m");
compiler.runtime.customInstaller("myapp_installer", results, ‘RuntimeDelivery’, ‘installer’);
however, the generated package has the same 1.2GB in size. I have followed the help page of compiler.runtime.customInstaller
https://www.mathworks.com/help/compiler/compiler.runtime.custominstaller.html
did I miss anything? why customInstaller fails to trim the installer size? my app only use basic matlab features.
the requiredMCRProducts.txt file shows that I only need the following MCR components
‘MATLAB Runtime – Core’
‘MATLAB Runtime – Graphics’
‘MATLAB Runtime – Non Interactive MATLAB’
‘MATLAB Runtime – Numerics’
‘MATLAB Runtime – Image Processing Toolbox Addin’ I have a matlab toolbox, with a single-window GUI. I was able to build it mcc/deploytool to create a standalone 7MB executable. However, I was not happy for the installer size, as the R2016 matlab runtime is 700MB in size, 100x larger than my application.
When I saw a new matlab compiler API compiler.runtime.custominstaller coming with R2024b is cable of creating smaller MCR installer including only needed files, I was very happy and immediately tried it on free mod apk games website, however, the result was disappointing.
The installer bundled with MCR in R2024b for my app build by deploytool – without using the customInstaller – is 1.2GB in size (another 2x increase in size compared to the already large package generated by R2016). Then, when I called
results = compiler.build.standaloneApplication("myapp.m");
compiler.runtime.customInstaller("myapp_installer", results, ‘RuntimeDelivery’, ‘installer’);
however, the generated package has the same 1.2GB in size. I have followed the help page of compiler.runtime.customInstaller
https://www.mathworks.com/help/compiler/compiler.runtime.custominstaller.html
did I miss anything? why customInstaller fails to trim the installer size? my app only use basic matlab features.
the requiredMCRProducts.txt file shows that I only need the following MCR components
‘MATLAB Runtime – Core’
‘MATLAB Runtime – Graphics’
‘MATLAB Runtime – Non Interactive MATLAB’
‘MATLAB Runtime – Numerics’
‘MATLAB Runtime – Image Processing Toolbox Addin’ matlab MATLAB Answers — New Questions
getSlope function issues for MATLAB code
I am trying to run this program in MATLAB R2024a but getting errors:
https://www.mathworks.com/matlabcentral/fileexchange/47605-creating-a-motion-detector-using-an-arduino-a-photoresistor-and-matlab
I might just be reading the code wrong but it looks like this script used a function ‘getSlope’ on line 93 of the ‘Run_Motion_Detector’ function. When I try to run this code it displays an error saying it (getSlope) is an undefined function or variable. Am I missing this function in an update or has it been replaced by a recent update? Is there an equivalent function in MATLAB I can code as a substitute ? The code’s authors states:
Slope Method – calculates a best-fit linear slope for a window of data. Requires both the voltage readings and their corresponding timestamps.I am trying to run this program in MATLAB R2024a but getting errors:
https://www.mathworks.com/matlabcentral/fileexchange/47605-creating-a-motion-detector-using-an-arduino-a-photoresistor-and-matlab
I might just be reading the code wrong but it looks like this script used a function ‘getSlope’ on line 93 of the ‘Run_Motion_Detector’ function. When I try to run this code it displays an error saying it (getSlope) is an undefined function or variable. Am I missing this function in an update or has it been replaced by a recent update? Is there an equivalent function in MATLAB I can code as a substitute ? The code’s authors states:
Slope Method – calculates a best-fit linear slope for a window of data. Requires both the voltage readings and their corresponding timestamps. I am trying to run this program in MATLAB R2024a but getting errors:
https://www.mathworks.com/matlabcentral/fileexchange/47605-creating-a-motion-detector-using-an-arduino-a-photoresistor-and-matlab
I might just be reading the code wrong but it looks like this script used a function ‘getSlope’ on line 93 of the ‘Run_Motion_Detector’ function. When I try to run this code it displays an error saying it (getSlope) is an undefined function or variable. Am I missing this function in an update or has it been replaced by a recent update? Is there an equivalent function in MATLAB I can code as a substitute ? The code’s authors states:
Slope Method – calculates a best-fit linear slope for a window of data. Requires both the voltage readings and their corresponding timestamps. getslope, slope, matlab, arduino, motion detector, photoresistor MATLAB Answers — New Questions
Unable to get electric drive train model working
Happy new year to all.
I am currently trying to create a simple electric drive train model, where it uses a battery connected to a converter to a motor and then calculate the thrust generated from the torque/rpm provided by the motor. I was also planning to include a simple feedback loop to ensure the input RPM was fulfiled.
In short, what i want to learn is, by having varying RPM input, how the motor would adjust itself to achieve the required RPM and how would this affect the battery SOC and the thrust calculation.
However, the output of my results is forever 0. Does anyone know where I gone wrong and if anyone could help me remedy my model. This would mean a lot, thank you in advance!
p.s. i am not an expert in electrical component, so do advise on what could be done.Happy new year to all.
I am currently trying to create a simple electric drive train model, where it uses a battery connected to a converter to a motor and then calculate the thrust generated from the torque/rpm provided by the motor. I was also planning to include a simple feedback loop to ensure the input RPM was fulfiled.
In short, what i want to learn is, by having varying RPM input, how the motor would adjust itself to achieve the required RPM and how would this affect the battery SOC and the thrust calculation.
However, the output of my results is forever 0. Does anyone know where I gone wrong and if anyone could help me remedy my model. This would mean a lot, thank you in advance!
p.s. i am not an expert in electrical component, so do advise on what could be done. Happy new year to all.
I am currently trying to create a simple electric drive train model, where it uses a battery connected to a converter to a motor and then calculate the thrust generated from the torque/rpm provided by the motor. I was also planning to include a simple feedback loop to ensure the input RPM was fulfiled.
In short, what i want to learn is, by having varying RPM input, how the motor would adjust itself to achieve the required RPM and how would this affect the battery SOC and the thrust calculation.
However, the output of my results is forever 0. Does anyone know where I gone wrong and if anyone could help me remedy my model. This would mean a lot, thank you in advance!
p.s. i am not an expert in electrical component, so do advise on what could be done. simulink, simscape, electric_motor_control MATLAB Answers — New Questions
CANOE与Simulink联合仿真生成dll出错
call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
提示如下:
### Processing Template Makefile: D:ProgramsMATLABR2021brtwccanoecn_msdll.tmf
### Created makefile C:Users…DesktopaSignalAccessSignalAccess_cn_rtwSignalAccess.mk
### Building SignalAccess: .\SignalAccess.bat
C:…DesktopaSignalAccessSignalAccess_cn_rtw>call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
文件名、目录名或卷标语法不正确。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>nmake -f SignalAccess.mk MAT_FILE=1 GENERATE_MODEL_DESCRIPTION=1 DEBUG_BUILD=0 HAS_WES64_BUILD=0 HAS_WES_BUILD=1 HAS_ERT_BUILD=0 GENERATE_VMODULE=0 COMBINE_OUTPUT_UPDATE_FCNS=0 INCLUDE_MDL_TERMINATE_FCN=1 MULTI_INSTANCE_CODE=0 OPTS="-DTID01EQ=0" TARGET_ARCH="x86" XCP_MAX_MSG_LENGTH=-1 ANALYSIS_MODEL=0 HAS_CAPL_CALL=0 DO_COMPILER_OPTIMIZATION=0 BUILD_ERT=0
‘nmake’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>echo The make command returned an error of 9009
The make command returned an error of 9009
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>An_error_occurred_during_the_call_to_make
‘An_error_occurred_during_the_call_to_make’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
提示如下:
### Processing Template Makefile: D:ProgramsMATLABR2021brtwccanoecn_msdll.tmf
### Created makefile C:Users…DesktopaSignalAccessSignalAccess_cn_rtwSignalAccess.mk
### Building SignalAccess: .\SignalAccess.bat
C:…DesktopaSignalAccessSignalAccess_cn_rtw>call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
文件名、目录名或卷标语法不正确。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>nmake -f SignalAccess.mk MAT_FILE=1 GENERATE_MODEL_DESCRIPTION=1 DEBUG_BUILD=0 HAS_WES64_BUILD=0 HAS_WES_BUILD=1 HAS_ERT_BUILD=0 GENERATE_VMODULE=0 COMBINE_OUTPUT_UPDATE_FCNS=0 INCLUDE_MDL_TERMINATE_FCN=1 MULTI_INSTANCE_CODE=0 OPTS="-DTID01EQ=0" TARGET_ARCH="x86" XCP_MAX_MSG_LENGTH=-1 ANALYSIS_MODEL=0 HAS_CAPL_CALL=0 DO_COMPILER_OPTIMIZATION=0 BUILD_ERT=0
‘nmake’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>echo The make command returned an error of 9009
The make command returned an error of 9009
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>An_error_occurred_during_the_call_to_make
‘An_error_occurred_during_the_call_to_make’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。 call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
提示如下:
### Processing Template Makefile: D:ProgramsMATLABR2021brtwccanoecn_msdll.tmf
### Created makefile C:Users…DesktopaSignalAccessSignalAccess_cn_rtwSignalAccess.mk
### Building SignalAccess: .\SignalAccess.bat
C:…DesktopaSignalAccessSignalAccess_cn_rtw>call "set MINGW_ROOT_PATH=C:TDM-GCC-64" x86
文件名、目录名或卷标语法不正确。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>nmake -f SignalAccess.mk MAT_FILE=1 GENERATE_MODEL_DESCRIPTION=1 DEBUG_BUILD=0 HAS_WES64_BUILD=0 HAS_WES_BUILD=1 HAS_ERT_BUILD=0 GENERATE_VMODULE=0 COMBINE_OUTPUT_UPDATE_FCNS=0 INCLUDE_MDL_TERMINATE_FCN=1 MULTI_INSTANCE_CODE=0 OPTS="-DTID01EQ=0" TARGET_ARCH="x86" XCP_MAX_MSG_LENGTH=-1 ANALYSIS_MODEL=0 HAS_CAPL_CALL=0 DO_COMPILER_OPTIMIZATION=0 BUILD_ERT=0
‘nmake’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>echo The make command returned an error of 9009
The make command returned an error of 9009
C:Users…DesktopaSignalAccessSignalAccess_cn_rtw>An_error_occurred_during_the_call_to_make
‘An_error_occurred_during_the_call_to_make’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。 canoe联合仿真 MATLAB Answers — New Questions
How to save a text file as a .mat file?
Hi,
I have a text file having data with each row having the format: a1,a2,a3,a4. I have close 2k such rows. I need to save the full text file as a .mat file. How do I get that? I already tried tetxscan but I run into cell within cell issue. Appreciate help.Hi,
I have a text file having data with each row having the format: a1,a2,a3,a4. I have close 2k such rows. I need to save the full text file as a .mat file. How do I get that? I already tried tetxscan but I run into cell within cell issue. Appreciate help. Hi,
I have a text file having data with each row having the format: a1,a2,a3,a4. I have close 2k such rows. I need to save the full text file as a .mat file. How do I get that? I already tried tetxscan but I run into cell within cell issue. Appreciate help. text file, textscan, mat-file MATLAB Answers — New Questions
Matlab R2020b freezes when closing figure (Intel macOS Big Sur)
Matlab R2020b Update 3 always freezes when closing a figure window containing any axes by using the top left closing button.
The operating system I am using is macOS Big Sur 11.1 on an Intel Mac Book Pro from mid-2017. No startup scripts are run.
On my system this can always be reproduced by opening Matlab 2020b and run the following command from the command window
figure; plot(1:10,1:10)
The figure opens as expected but using the red close button on the top left corner to close the window, Matlab instantly freezes and a spinning ball animation is shown. Matlab must be force quit then.
There is no problem closing the figure using the command
close(gcf)
This bug makes working with Matlab completely impossible to me. A similar behaviour could be seen on my system with previous Matlab versions like R2020a on macOS Mojave. But back then the bug was not so easy to reproduce. From time to time when closing a window belonging to Matlab it also froze.Matlab R2020b Update 3 always freezes when closing a figure window containing any axes by using the top left closing button.
The operating system I am using is macOS Big Sur 11.1 on an Intel Mac Book Pro from mid-2017. No startup scripts are run.
On my system this can always be reproduced by opening Matlab 2020b and run the following command from the command window
figure; plot(1:10,1:10)
The figure opens as expected but using the red close button on the top left corner to close the window, Matlab instantly freezes and a spinning ball animation is shown. Matlab must be force quit then.
There is no problem closing the figure using the command
close(gcf)
This bug makes working with Matlab completely impossible to me. A similar behaviour could be seen on my system with previous Matlab versions like R2020a on macOS Mojave. But back then the bug was not so easy to reproduce. From time to time when closing a window belonging to Matlab it also froze. Matlab R2020b Update 3 always freezes when closing a figure window containing any axes by using the top left closing button.
The operating system I am using is macOS Big Sur 11.1 on an Intel Mac Book Pro from mid-2017. No startup scripts are run.
On my system this can always be reproduced by opening Matlab 2020b and run the following command from the command window
figure; plot(1:10,1:10)
The figure opens as expected but using the red close button on the top left corner to close the window, Matlab instantly freezes and a spinning ball animation is shown. Matlab must be force quit then.
There is no problem closing the figure using the command
close(gcf)
This bug makes working with Matlab completely impossible to me. A similar behaviour could be seen on my system with previous Matlab versions like R2020a on macOS Mojave. But back then the bug was not so easy to reproduce. From time to time when closing a window belonging to Matlab it also froze. freeze, macos, big sur, figure, close MATLAB Answers — New Questions