Tag Archives: matlab
Automatic reenabling and disabling statflow chart
I have a simple state machine that I would like to disable automatically via Enable_SM once all states within the Stateflow chart are executed (done). After the state machine has finished execution, I want the toggle switch to switch off automatically.
Then, I would like to be able to start the state machine manually again using the toggle switch.
Can you please advise me how to implement this?I have a simple state machine that I would like to disable automatically via Enable_SM once all states within the Stateflow chart are executed (done). After the state machine has finished execution, I want the toggle switch to switch off automatically.
Then, I would like to be able to start the state machine manually again using the toggle switch.
Can you please advise me how to implement this? I have a simple state machine that I would like to disable automatically via Enable_SM once all states within the Stateflow chart are executed (done). After the state machine has finished execution, I want the toggle switch to switch off automatically.
Then, I would like to be able to start the state machine manually again using the toggle switch.
Can you please advise me how to implement this? automatic reenabling and disabling stateflow chart MATLAB Answers — New Questions
MATLAB won’t invert a function in the Laplace domain…
We are using a fairly simple function of the gamma distribution. When I use whole numbers for the "n" parameter, MATLAB inverts the function well. However, when I use non-integer values for n (e.g., n=11/10 or 1.1), MATLAB is unable to invert the function.
Here is the error message:
Warning: Error in state of SceneNode. The following error was reported evaluating the function in FunctionLine update: Unable to convert symbolic expression to double array because it contains symbolic function that does not evaluate to number. Input expression must evaluate to number.
I want to be able to use various values of n that are not integers.
Here is my code.
Do I need to use a numerical inversion method? or is there a simple means of fixing this withing MATLAB?
% Clear all variables and close all plots.
clc
close all;
clear all;
% Declare the variables that are symbolic.
syms t s N n m r t_close tbar
syms E_t E_s Day_hours
syms C_a_s C_a_t Fun_s
% Define the values of the model parameters
tbar=8; % tbar is one of the gamma distribution parameters.
n=1; % n is the second of two parameters needed to
% define the gamma distribution shape. set n=1.1, and it
% does not work.
Day_length=24;
r=0.5;
t_close=8;
m=sym(tbar/t_close);
% N is the number of cycles for which we
% want this to run. For now, one cycle is
% enough to determine whether this will work.
for N=1
% Define the gamma distribution
E_t(N)=((1/tbar)*(((t)/tbar)^(n-1))*((n^n)/gamma(n))*exp(-n*(t)/tbar));
% Transform the gamma distribution into the Laplace domain
E_s(N)=laplace(E_t(N));
% Define a function that is a result of a derivation
Fun_s(N)=(exp(-Day_length*(N-1)*s))/s-exp((-Day_length*(N-1)-t_close)*s)/s;
% Define the concentration function in the Laplace domain
C_a_s(N)=(m/(tbar*s))*((1-E_s(N))/(1-r*E_s(N)))*Fun_s(N);
% Now, take the inverse laplace of the concentration function to
% put it in the time domain.
% if n is not an integer, it won’t invert the function.
% any ideas???
C_a_t(N) = ilaplace(C_a_s(N),s,t)
fplot(C_a_t(N),[0 60])
endWe are using a fairly simple function of the gamma distribution. When I use whole numbers for the "n" parameter, MATLAB inverts the function well. However, when I use non-integer values for n (e.g., n=11/10 or 1.1), MATLAB is unable to invert the function.
Here is the error message:
Warning: Error in state of SceneNode. The following error was reported evaluating the function in FunctionLine update: Unable to convert symbolic expression to double array because it contains symbolic function that does not evaluate to number. Input expression must evaluate to number.
I want to be able to use various values of n that are not integers.
Here is my code.
Do I need to use a numerical inversion method? or is there a simple means of fixing this withing MATLAB?
% Clear all variables and close all plots.
clc
close all;
clear all;
% Declare the variables that are symbolic.
syms t s N n m r t_close tbar
syms E_t E_s Day_hours
syms C_a_s C_a_t Fun_s
% Define the values of the model parameters
tbar=8; % tbar is one of the gamma distribution parameters.
n=1; % n is the second of two parameters needed to
% define the gamma distribution shape. set n=1.1, and it
% does not work.
Day_length=24;
r=0.5;
t_close=8;
m=sym(tbar/t_close);
% N is the number of cycles for which we
% want this to run. For now, one cycle is
% enough to determine whether this will work.
for N=1
% Define the gamma distribution
E_t(N)=((1/tbar)*(((t)/tbar)^(n-1))*((n^n)/gamma(n))*exp(-n*(t)/tbar));
% Transform the gamma distribution into the Laplace domain
E_s(N)=laplace(E_t(N));
% Define a function that is a result of a derivation
Fun_s(N)=(exp(-Day_length*(N-1)*s))/s-exp((-Day_length*(N-1)-t_close)*s)/s;
% Define the concentration function in the Laplace domain
C_a_s(N)=(m/(tbar*s))*((1-E_s(N))/(1-r*E_s(N)))*Fun_s(N);
% Now, take the inverse laplace of the concentration function to
% put it in the time domain.
% if n is not an integer, it won’t invert the function.
% any ideas???
C_a_t(N) = ilaplace(C_a_s(N),s,t)
fplot(C_a_t(N),[0 60])
end We are using a fairly simple function of the gamma distribution. When I use whole numbers for the "n" parameter, MATLAB inverts the function well. However, when I use non-integer values for n (e.g., n=11/10 or 1.1), MATLAB is unable to invert the function.
Here is the error message:
Warning: Error in state of SceneNode. The following error was reported evaluating the function in FunctionLine update: Unable to convert symbolic expression to double array because it contains symbolic function that does not evaluate to number. Input expression must evaluate to number.
I want to be able to use various values of n that are not integers.
Here is my code.
Do I need to use a numerical inversion method? or is there a simple means of fixing this withing MATLAB?
% Clear all variables and close all plots.
clc
close all;
clear all;
% Declare the variables that are symbolic.
syms t s N n m r t_close tbar
syms E_t E_s Day_hours
syms C_a_s C_a_t Fun_s
% Define the values of the model parameters
tbar=8; % tbar is one of the gamma distribution parameters.
n=1; % n is the second of two parameters needed to
% define the gamma distribution shape. set n=1.1, and it
% does not work.
Day_length=24;
r=0.5;
t_close=8;
m=sym(tbar/t_close);
% N is the number of cycles for which we
% want this to run. For now, one cycle is
% enough to determine whether this will work.
for N=1
% Define the gamma distribution
E_t(N)=((1/tbar)*(((t)/tbar)^(n-1))*((n^n)/gamma(n))*exp(-n*(t)/tbar));
% Transform the gamma distribution into the Laplace domain
E_s(N)=laplace(E_t(N));
% Define a function that is a result of a derivation
Fun_s(N)=(exp(-Day_length*(N-1)*s))/s-exp((-Day_length*(N-1)-t_close)*s)/s;
% Define the concentration function in the Laplace domain
C_a_s(N)=(m/(tbar*s))*((1-E_s(N))/(1-r*E_s(N)))*Fun_s(N);
% Now, take the inverse laplace of the concentration function to
% put it in the time domain.
% if n is not an integer, it won’t invert the function.
% any ideas???
C_a_t(N) = ilaplace(C_a_s(N),s,t)
fplot(C_a_t(N),[0 60])
end inversion of a laplace transform MATLAB Answers — New Questions
create array and plot the function
I am trying to create an array of 100 input samples in the range of 1 to 100 using the linspace function, and plot the equation y(x)=20 log10(2x) on a semilogx plot. I would also like to draw a solid blue line of width 2, and label each point with a red circle. And I want to create an array of 100 input samples in the range of 1 to 100 using the logspace function, and plot the equation y(x)=20 log10(2x) on a semilogx plot with a solid red line of width 2, and label each point with a black star.I am trying to create an array of 100 input samples in the range of 1 to 100 using the linspace function, and plot the equation y(x)=20 log10(2x) on a semilogx plot. I would also like to draw a solid blue line of width 2, and label each point with a red circle. And I want to create an array of 100 input samples in the range of 1 to 100 using the logspace function, and plot the equation y(x)=20 log10(2x) on a semilogx plot with a solid red line of width 2, and label each point with a black star. I am trying to create an array of 100 input samples in the range of 1 to 100 using the linspace function, and plot the equation y(x)=20 log10(2x) on a semilogx plot. I would also like to draw a solid blue line of width 2, and label each point with a red circle. And I want to create an array of 100 input samples in the range of 1 to 100 using the logspace function, and plot the equation y(x)=20 log10(2x) on a semilogx plot with a solid red line of width 2, and label each point with a black star. array, plotting, complex MATLAB Answers — New Questions
new network license server
I currently have FlexLM installed on a physical node for MATLAB. Since we need to decommission this node, I must migrate to a new FlexLM installation on a virtual machine with MAC address fa:16:3e:03:a4:90. Could you please provide me with a link to a guide on how to perform this migration?I currently have FlexLM installed on a physical node for MATLAB. Since we need to decommission this node, I must migrate to a new FlexLM installation on a virtual machine with MAC address fa:16:3e:03:a4:90. Could you please provide me with a link to a guide on how to perform this migration? I currently have FlexLM installed on a physical node for MATLAB. Since we need to decommission this node, I must migrate to a new FlexLM installation on a virtual machine with MAC address fa:16:3e:03:a4:90. Could you please provide me with a link to a guide on how to perform this migration? flexlm MATLAB Answers — New Questions
C Caller error when passing 2D array inside struct via Simulink bus
I have a variable in C header defined as
typedef struct {
double a[1][4];
} temp
and a C function:
void Fun(Temp* temp) {
}
In Simulink, I try to send 1×4 data packed into a bus and pass it to the C Caller block, which calls Fun() as shown in the below images.
However, when building, I get the following errors:
m_6ytl4aiSKJUAISadDdLIqD.c
m_6ytl4aiSKJUAISadDdLIqD.c(52): error C2440: ‘=’: cannot convert from ‘float64 [4]’ to ‘real_T’
m_6ytl4aiSKJUAISadDdLIqD.c(57): error C2440: ‘=’: cannot convert from ‘float64 *’ to ‘real_T’
Interestingly, if I do not use the struct and bus, and instead directly pass a pure 1×4 array like this:
void Fun(double a[][4]) {
}
then it works fine.
So, the error occurs only when the 2D array is packaged inside a struct and transmitted via a Simulink bus.
Could you help me understand why this happens, and how to properly map the bus signal to the struct array in C Caller?
Thank you!I have a variable in C header defined as
typedef struct {
double a[1][4];
} temp
and a C function:
void Fun(Temp* temp) {
}
In Simulink, I try to send 1×4 data packed into a bus and pass it to the C Caller block, which calls Fun() as shown in the below images.
However, when building, I get the following errors:
m_6ytl4aiSKJUAISadDdLIqD.c
m_6ytl4aiSKJUAISadDdLIqD.c(52): error C2440: ‘=’: cannot convert from ‘float64 [4]’ to ‘real_T’
m_6ytl4aiSKJUAISadDdLIqD.c(57): error C2440: ‘=’: cannot convert from ‘float64 *’ to ‘real_T’
Interestingly, if I do not use the struct and bus, and instead directly pass a pure 1×4 array like this:
void Fun(double a[][4]) {
}
then it works fine.
So, the error occurs only when the 2D array is packaged inside a struct and transmitted via a Simulink bus.
Could you help me understand why this happens, and how to properly map the bus signal to the struct array in C Caller?
Thank you! I have a variable in C header defined as
typedef struct {
double a[1][4];
} temp
and a C function:
void Fun(Temp* temp) {
}
In Simulink, I try to send 1×4 data packed into a bus and pass it to the C Caller block, which calls Fun() as shown in the below images.
However, when building, I get the following errors:
m_6ytl4aiSKJUAISadDdLIqD.c
m_6ytl4aiSKJUAISadDdLIqD.c(52): error C2440: ‘=’: cannot convert from ‘float64 [4]’ to ‘real_T’
m_6ytl4aiSKJUAISadDdLIqD.c(57): error C2440: ‘=’: cannot convert from ‘float64 *’ to ‘real_T’
Interestingly, if I do not use the struct and bus, and instead directly pass a pure 1×4 array like this:
void Fun(double a[][4]) {
}
then it works fine.
So, the error occurs only when the 2D array is packaged inside a struct and transmitted via a Simulink bus.
Could you help me understand why this happens, and how to properly map the bus signal to the struct array in C Caller?
Thank you! simulink, c caller MATLAB Answers — New Questions
what do the AudioDeviceWriter do with a complex inputdata?
when i use ifft() to process and get a frame of audio data but forget to real() the results, it sounds weired.
so i wonder what happened when AudioDeviceWriter play with a complex inputdata?
i try it with a 1kHz pure tone and then plus it with a very little imag part,when played independently(commented the other),these two sound very different. but when i play the two in sequence with a pause(3),when the complex one first and real one latter,they sound the same(weired).
furthermore. when i change the order, put the real one first and the complex one latter, an error occured.
i’ll be glad to get an answer to the question ,thank you!
here is the code,you can change the order of adw(playbuff2) and adw(playbuff) then test ;
clc;
clear;
fs=48e3;
f0=1e3;
T=1;
N=1:T*fs;
t=N/fs;
wav=sin(2*pi*f0*t).’;
adw=audioDeviceWriter(‘SampleRate’,fs);
wav2=wav;
wav2=wav+1e-18*j*ones(size(wav));
playbuff2=[wav2];
playbuff=[wav];
adw(playbuff2);
pause(3);
adw(playbuff);when i use ifft() to process and get a frame of audio data but forget to real() the results, it sounds weired.
so i wonder what happened when AudioDeviceWriter play with a complex inputdata?
i try it with a 1kHz pure tone and then plus it with a very little imag part,when played independently(commented the other),these two sound very different. but when i play the two in sequence with a pause(3),when the complex one first and real one latter,they sound the same(weired).
furthermore. when i change the order, put the real one first and the complex one latter, an error occured.
i’ll be glad to get an answer to the question ,thank you!
here is the code,you can change the order of adw(playbuff2) and adw(playbuff) then test ;
clc;
clear;
fs=48e3;
f0=1e3;
T=1;
N=1:T*fs;
t=N/fs;
wav=sin(2*pi*f0*t).’;
adw=audioDeviceWriter(‘SampleRate’,fs);
wav2=wav;
wav2=wav+1e-18*j*ones(size(wav));
playbuff2=[wav2];
playbuff=[wav];
adw(playbuff2);
pause(3);
adw(playbuff); when i use ifft() to process and get a frame of audio data but forget to real() the results, it sounds weired.
so i wonder what happened when AudioDeviceWriter play with a complex inputdata?
i try it with a 1kHz pure tone and then plus it with a very little imag part,when played independently(commented the other),these two sound very different. but when i play the two in sequence with a pause(3),when the complex one first and real one latter,they sound the same(weired).
furthermore. when i change the order, put the real one first and the complex one latter, an error occured.
i’ll be glad to get an answer to the question ,thank you!
here is the code,you can change the order of adw(playbuff2) and adw(playbuff) then test ;
clc;
clear;
fs=48e3;
f0=1e3;
T=1;
N=1:T*fs;
t=N/fs;
wav=sin(2*pi*f0*t).’;
adw=audioDeviceWriter(‘SampleRate’,fs);
wav2=wav;
wav2=wav+1e-18*j*ones(size(wav));
playbuff2=[wav2];
playbuff=[wav];
adw(playbuff2);
pause(3);
adw(playbuff); audiodevicewriter, complex MATLAB Answers — New Questions
Time to peak using findpeaks
I’m using findpeaks to locate multiple peaks in my function but I want to know the rising time to the peak.
Findpeaks gives you the ‘width’ output but its not working because it suposses that the peak is in the middle of the valleys (and its based on the prominece, it would be nice to be referenced to lowestPoint/left valley) but most of these peaks are not symetric so its not working properly, any ideas?I’m using findpeaks to locate multiple peaks in my function but I want to know the rising time to the peak.
Findpeaks gives you the ‘width’ output but its not working because it suposses that the peak is in the middle of the valleys (and its based on the prominece, it would be nice to be referenced to lowestPoint/left valley) but most of these peaks are not symetric so its not working properly, any ideas? I’m using findpeaks to locate multiple peaks in my function but I want to know the rising time to the peak.
Findpeaks gives you the ‘width’ output but its not working because it suposses that the peak is in the middle of the valleys (and its based on the prominece, it would be nice to be referenced to lowestPoint/left valley) but most of these peaks are not symetric so its not working properly, any ideas? findpeaks, rising time MATLAB Answers — New Questions
Legend in multiple plots: example bubblecharts or combined plot bubblechart and scatter
Hi, I am trying to display to variables on a map and add a legend for both of the variables. Since I the problems is the legend I removed the map behind the plot to just focus on the variables.
I splitted the two variables first in two seperate plots to show how the legend should look like for each variable. Than I combine it in two ways and discuss the legend problems that I have face.
% create random data
xCoordinate = randi([3.1976e+05 8.2960e+05],21, 1); %Location on a map xCoordinate
yCoordinate = randi([6.1639e+06 7.2924e+06],21, 1); %Location on a map yCoordinate
markerSizesV = randi([0 5],21, 1);
markerSizesC = randi([1 379],21, 1);
%% create bubblechart Cats per km^2 of region with legend
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]); %FaceColor white
bC.MarkerEdgeColor = [0,0,0]; %EdgeColor black
bubblesize([4 15]) % limit the bubblesize
axis equal % ensures 1 unit in x equals 1 unit in y
axis off % romoves the axis
blgdC1 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); % plots the legend
The legend for Cats per km^2 should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% create bubblechart Cat visits per region with legend
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV1 = bubblelegend({‘Cat Visits’;’per region’});
The legend for Cat visits per region should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% combined bubblechart Cats per km^2 and Cat visits per region
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]);
hold on
bC.MarkerEdgeColor = [0,0,0];
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
blgdC2 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); %
blgdV2 = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’) %test what legend does
hold off
As soon as I combine two bubblecharts MATLAB combines valus in ratio to each other and combines it also into the same population legend. This is fine if I would have two variables with the same unit / content but different regions.
Therefore I tryed a version with
%% combine bubblechart Cat visits per region with scatter Cats per km^2
s = scatter(xCoordinate,yCoordinate,markerSizesC/2, MarkerFaceColor = "white", MarkerEdgeColor = "#36454F");
hold on
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’)
hold off
This solves at least the problem that MATLAB considers these two variables should be in relation to each other. Plus the legend for "Cat visits per region" is correct and with the right color and right size.
However I don’t get a legend like this next to my plot as in the bubblechart combinded with scatter.
Is their anyone knowing how to solve this issue with legends?
Thanks for any input in this matter.Hi, I am trying to display to variables on a map and add a legend for both of the variables. Since I the problems is the legend I removed the map behind the plot to just focus on the variables.
I splitted the two variables first in two seperate plots to show how the legend should look like for each variable. Than I combine it in two ways and discuss the legend problems that I have face.
% create random data
xCoordinate = randi([3.1976e+05 8.2960e+05],21, 1); %Location on a map xCoordinate
yCoordinate = randi([6.1639e+06 7.2924e+06],21, 1); %Location on a map yCoordinate
markerSizesV = randi([0 5],21, 1);
markerSizesC = randi([1 379],21, 1);
%% create bubblechart Cats per km^2 of region with legend
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]); %FaceColor white
bC.MarkerEdgeColor = [0,0,0]; %EdgeColor black
bubblesize([4 15]) % limit the bubblesize
axis equal % ensures 1 unit in x equals 1 unit in y
axis off % romoves the axis
blgdC1 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); % plots the legend
The legend for Cats per km^2 should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% create bubblechart Cat visits per region with legend
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV1 = bubblelegend({‘Cat Visits’;’per region’});
The legend for Cat visits per region should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% combined bubblechart Cats per km^2 and Cat visits per region
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]);
hold on
bC.MarkerEdgeColor = [0,0,0];
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
blgdC2 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); %
blgdV2 = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’) %test what legend does
hold off
As soon as I combine two bubblecharts MATLAB combines valus in ratio to each other and combines it also into the same population legend. This is fine if I would have two variables with the same unit / content but different regions.
Therefore I tryed a version with
%% combine bubblechart Cat visits per region with scatter Cats per km^2
s = scatter(xCoordinate,yCoordinate,markerSizesC/2, MarkerFaceColor = "white", MarkerEdgeColor = "#36454F");
hold on
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’)
hold off
This solves at least the problem that MATLAB considers these two variables should be in relation to each other. Plus the legend for "Cat visits per region" is correct and with the right color and right size.
However I don’t get a legend like this next to my plot as in the bubblechart combinded with scatter.
Is their anyone knowing how to solve this issue with legends?
Thanks for any input in this matter. Hi, I am trying to display to variables on a map and add a legend for both of the variables. Since I the problems is the legend I removed the map behind the plot to just focus on the variables.
I splitted the two variables first in two seperate plots to show how the legend should look like for each variable. Than I combine it in two ways and discuss the legend problems that I have face.
% create random data
xCoordinate = randi([3.1976e+05 8.2960e+05],21, 1); %Location on a map xCoordinate
yCoordinate = randi([6.1639e+06 7.2924e+06],21, 1); %Location on a map yCoordinate
markerSizesV = randi([0 5],21, 1);
markerSizesC = randi([1 379],21, 1);
%% create bubblechart Cats per km^2 of region with legend
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]); %FaceColor white
bC.MarkerEdgeColor = [0,0,0]; %EdgeColor black
bubblesize([4 15]) % limit the bubblesize
axis equal % ensures 1 unit in x equals 1 unit in y
axis off % romoves the axis
blgdC1 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); % plots the legend
The legend for Cats per km^2 should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% create bubblechart Cat visits per region with legend
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV1 = bubblelegend({‘Cat Visits’;’per region’});
The legend for Cat visits per region should look like in the plot above. (Ignor the that some of the bubbles are getting cut off this doesn’t happens when the map is ploted as well.)
%% combined bubblechart Cats per km^2 and Cat visits per region
bC = bubblechart(xCoordinate,yCoordinate,markerSizesC, [1, 1, 1]);
hold on
bC.MarkerEdgeColor = [0,0,0];
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
blgdC2 = bubblelegend({‘Cats’;’per km^2′},’Location’,’eastoutside’); %
blgdV2 = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’) %test what legend does
hold off
As soon as I combine two bubblecharts MATLAB combines valus in ratio to each other and combines it also into the same population legend. This is fine if I would have two variables with the same unit / content but different regions.
Therefore I tryed a version with
%% combine bubblechart Cat visits per region with scatter Cats per km^2
s = scatter(xCoordinate,yCoordinate,markerSizesC/2, MarkerFaceColor = "white", MarkerEdgeColor = "#36454F");
hold on
bV = bubblechart(xCoordinate,yCoordinate,markerSizesV, [0.9290, 0.6940, 0.1250]);
bubblesize([4 15])
axis equal % ensures 1 unit in x equals 1 unit in y
axis off
blgdV = bubblelegend({‘Cat Visits’;’per region’},’Location’,’westoutside’);
legend(‘Cats per km^2’, ‘Cat Visits per Region’)
hold off
This solves at least the problem that MATLAB considers these two variables should be in relation to each other. Plus the legend for "Cat visits per region" is correct and with the right color and right size.
However I don’t get a legend like this next to my plot as in the bubblechart combinded with scatter.
Is their anyone knowing how to solve this issue with legends?
Thanks for any input in this matter. legend, multiple, bubblechart, scatter plot MATLAB Answers — New Questions
Interacting wih figures in 2025a
Hello!
After updating to MATLAB 2025a, I’ve noticed a significant decrease in performance when interacting with figures. Specifically, zooming, panning, and other figure manipulations are very slow and occasionally cause the program to freeze.
I often work with complex plots that include multiple tabs and numerous subplots, which means a large amount of data is being displayed. While I acknowledge this is a data-intensive use case, performance in previous MATLAB versions was much smoother.
I’m wondering if anyone else has experienced similar issues since the 2025a update?
It appears that my integrated UHD graphics is being used as the renderer device, despite my laptop having a dedicated NVIDIA GeForce GPU. Are there any settings I can adjust to force MATLAB to use my dedicated GPU for rendering to improve performance?
Any insights or potential solutions would be greatly appreciated! Thank you.Hello!
After updating to MATLAB 2025a, I’ve noticed a significant decrease in performance when interacting with figures. Specifically, zooming, panning, and other figure manipulations are very slow and occasionally cause the program to freeze.
I often work with complex plots that include multiple tabs and numerous subplots, which means a large amount of data is being displayed. While I acknowledge this is a data-intensive use case, performance in previous MATLAB versions was much smoother.
I’m wondering if anyone else has experienced similar issues since the 2025a update?
It appears that my integrated UHD graphics is being used as the renderer device, despite my laptop having a dedicated NVIDIA GeForce GPU. Are there any settings I can adjust to force MATLAB to use my dedicated GPU for rendering to improve performance?
Any insights or potential solutions would be greatly appreciated! Thank you. Hello!
After updating to MATLAB 2025a, I’ve noticed a significant decrease in performance when interacting with figures. Specifically, zooming, panning, and other figure manipulations are very slow and occasionally cause the program to freeze.
I often work with complex plots that include multiple tabs and numerous subplots, which means a large amount of data is being displayed. While I acknowledge this is a data-intensive use case, performance in previous MATLAB versions was much smoother.
I’m wondering if anyone else has experienced similar issues since the 2025a update?
It appears that my integrated UHD graphics is being used as the renderer device, despite my laptop having a dedicated NVIDIA GeForce GPU. Are there any settings I can adjust to force MATLAB to use my dedicated GPU for rendering to improve performance?
Any insights or potential solutions would be greatly appreciated! Thank you. 2025a, figure, performance MATLAB Answers — New Questions
Why doesn’t matlab start?
When I attempt to start matlab 2025a on windows 10, blank unresponsive window appears. I see that the task manager shows a "MathWorksCrashReporter.exe".
How do I determine what is going wrong?When I attempt to start matlab 2025a on windows 10, blank unresponsive window appears. I see that the task manager shows a "MathWorksCrashReporter.exe".
How do I determine what is going wrong? When I attempt to start matlab 2025a on windows 10, blank unresponsive window appears. I see that the task manager shows a "MathWorksCrashReporter.exe".
How do I determine what is going wrong? unresponsive MATLAB Answers — New Questions
Matlab installer not downloading
I have matlab license from my university. I wanted to download installer for matlab. But when I click on link displayed with "Download for Windows" it goes to "Your installer is downloading to your browser’s download folder." but nothing downloads. I have tried with various versions and different browsers but same thing happens. Can anyone help me in installing Matlab. As of now, I am using Matlab online version.I have matlab license from my university. I wanted to download installer for matlab. But when I click on link displayed with "Download for Windows" it goes to "Your installer is downloading to your browser’s download folder." but nothing downloads. I have tried with various versions and different browsers but same thing happens. Can anyone help me in installing Matlab. As of now, I am using Matlab online version. I have matlab license from my university. I wanted to download installer for matlab. But when I click on link displayed with "Download for Windows" it goes to "Your installer is downloading to your browser’s download folder." but nothing downloads. I have tried with various versions and different browsers but same thing happens. Can anyone help me in installing Matlab. As of now, I am using Matlab online version. downloading, matlab, installer, issue MATLAB Answers — New Questions
Properties validation in subclass with multiple superclass but same ancestor
hello everyone,
I have a problem: I’m trying to build a (quite complex) super/subclassing tree for a project, but I’m stuck before MATLAB failed at instanciating an object deriving from multiple classes but that at the end derive from the same root object, and in this root object I defined an abstract property, with some validators, that should be define in the concrete object.
According to this page, it should works, but it does NOT work in my case (MATLAB 2024a; I plan to migrate to newer versions soon).
Minimum Workin Example (MWE) completely unrelated to my project:
let’s suppose that i have to model several vehicles, so I can create a superclass called "vehicles" with some properties, including the minimum number of staff required to run it:
classdef vehicle < handle
properties (Abstract, Constant)
required_staff (1,1) {mustBeNumeric}
end
methods
function obj = vehicle()
end
end
end
Now, we can specialize the "vehicle" in several ways and multiple times, for example by creating a "landVehicle" class, a "bike" class (extending "landVehicle"), an "electricalVehicle" (all these classes may define something more, but for this MWE we can have them "empty" and it will not change) and finally the "EBike9000" that is an electrical bike.
Code for the "bike" class (the other mid-classes are similar):
classdef bike < landVehicle
end
Code for the "EBike9000" concrete class:
classdef EBike9000 < bike & electricalVehicle
properties (Constant)
required_staff = 1
end
end
Now, the only definition and validation for the required_staff property is in the root "vehicle" class. The middle class never mention it, however, when I tried to instantiate an EBike9000 object, matlab complain with:
Error using EBike9000
Class ‘electricalVehicle’ and class ‘bike’ both define validation for
Abstract property ‘required_staff’. When inheriting property validation,
only one superclass can define validation for property ‘required_staff’.
However, this validator IS the same since it belong to the same superclass, so it should NOT be a problem for MATLAB to validate it (as also stated in the page I linked at the beginning).
So, what’s going on? is this a bug, or it’s me that I’m missing something? Ideas for some workarounds (except including a set.required_staff method which on all the possible vehicles around)?hello everyone,
I have a problem: I’m trying to build a (quite complex) super/subclassing tree for a project, but I’m stuck before MATLAB failed at instanciating an object deriving from multiple classes but that at the end derive from the same root object, and in this root object I defined an abstract property, with some validators, that should be define in the concrete object.
According to this page, it should works, but it does NOT work in my case (MATLAB 2024a; I plan to migrate to newer versions soon).
Minimum Workin Example (MWE) completely unrelated to my project:
let’s suppose that i have to model several vehicles, so I can create a superclass called "vehicles" with some properties, including the minimum number of staff required to run it:
classdef vehicle < handle
properties (Abstract, Constant)
required_staff (1,1) {mustBeNumeric}
end
methods
function obj = vehicle()
end
end
end
Now, we can specialize the "vehicle" in several ways and multiple times, for example by creating a "landVehicle" class, a "bike" class (extending "landVehicle"), an "electricalVehicle" (all these classes may define something more, but for this MWE we can have them "empty" and it will not change) and finally the "EBike9000" that is an electrical bike.
Code for the "bike" class (the other mid-classes are similar):
classdef bike < landVehicle
end
Code for the "EBike9000" concrete class:
classdef EBike9000 < bike & electricalVehicle
properties (Constant)
required_staff = 1
end
end
Now, the only definition and validation for the required_staff property is in the root "vehicle" class. The middle class never mention it, however, when I tried to instantiate an EBike9000 object, matlab complain with:
Error using EBike9000
Class ‘electricalVehicle’ and class ‘bike’ both define validation for
Abstract property ‘required_staff’. When inheriting property validation,
only one superclass can define validation for property ‘required_staff’.
However, this validator IS the same since it belong to the same superclass, so it should NOT be a problem for MATLAB to validate it (as also stated in the page I linked at the beginning).
So, what’s going on? is this a bug, or it’s me that I’m missing something? Ideas for some workarounds (except including a set.required_staff method which on all the possible vehicles around)? hello everyone,
I have a problem: I’m trying to build a (quite complex) super/subclassing tree for a project, but I’m stuck before MATLAB failed at instanciating an object deriving from multiple classes but that at the end derive from the same root object, and in this root object I defined an abstract property, with some validators, that should be define in the concrete object.
According to this page, it should works, but it does NOT work in my case (MATLAB 2024a; I plan to migrate to newer versions soon).
Minimum Workin Example (MWE) completely unrelated to my project:
let’s suppose that i have to model several vehicles, so I can create a superclass called "vehicles" with some properties, including the minimum number of staff required to run it:
classdef vehicle < handle
properties (Abstract, Constant)
required_staff (1,1) {mustBeNumeric}
end
methods
function obj = vehicle()
end
end
end
Now, we can specialize the "vehicle" in several ways and multiple times, for example by creating a "landVehicle" class, a "bike" class (extending "landVehicle"), an "electricalVehicle" (all these classes may define something more, but for this MWE we can have them "empty" and it will not change) and finally the "EBike9000" that is an electrical bike.
Code for the "bike" class (the other mid-classes are similar):
classdef bike < landVehicle
end
Code for the "EBike9000" concrete class:
classdef EBike9000 < bike & electricalVehicle
properties (Constant)
required_staff = 1
end
end
Now, the only definition and validation for the required_staff property is in the root "vehicle" class. The middle class never mention it, however, when I tried to instantiate an EBike9000 object, matlab complain with:
Error using EBike9000
Class ‘electricalVehicle’ and class ‘bike’ both define validation for
Abstract property ‘required_staff’. When inheriting property validation,
only one superclass can define validation for property ‘required_staff’.
However, this validator IS the same since it belong to the same superclass, so it should NOT be a problem for MATLAB to validate it (as also stated in the page I linked at the beginning).
So, what’s going on? is this a bug, or it’s me that I’m missing something? Ideas for some workarounds (except including a set.required_staff method which on all the possible vehicles around)? oop, subclassing, superclass, properties validation MATLAB Answers — New Questions
How to correctly implement a pid control and fuzzy logic control on synchronous generator tied to ieee bus system?
Im trying to implement pid control and fuzzy logic excitation control separately for the synchronous generator for this ieee9 bus system to monitor/compare their performances in terms of voltage control, im struggling with that. Even with the current type1 exciter on the S.G it isnt giving the results it should at all. The stator current is stable until 2 s when it goes sky high for some reason and the Vf drops to extreme negative values. I really hope someone can help guide me in the right direction.Im trying to implement pid control and fuzzy logic excitation control separately for the synchronous generator for this ieee9 bus system to monitor/compare their performances in terms of voltage control, im struggling with that. Even with the current type1 exciter on the S.G it isnt giving the results it should at all. The stator current is stable until 2 s when it goes sky high for some reason and the Vf drops to extreme negative values. I really hope someone can help guide me in the right direction. Im trying to implement pid control and fuzzy logic excitation control separately for the synchronous generator for this ieee9 bus system to monitor/compare their performances in terms of voltage control, im struggling with that. Even with the current type1 exciter on the S.G it isnt giving the results it should at all. The stator current is stable until 2 s when it goes sky high for some reason and the Vf drops to extreme negative values. I really hope someone can help guide me in the right direction. synchronous generator, ieee bus 9, pid, fuzzy logic MATLAB Answers — New Questions
Hi,I am atanu.i wants a matlab simulation expart.i have a simulation problem regarding this paper given below and i also give the input data at the file book06.
the paper and matlab simulink file and input data i given.the paper and matlab simulink file and input data i given. the paper and matlab simulink file and input data i given. simulation MATLAB Answers — New Questions
Using RTX 5090 for GPU computing in forward compatibility
Dear users,
I have read a couple of very useful posts
https://www.mathworks.com/matlabcentral/answers/2173867-can-i-use-my-nvidia-blackwell-architecture-gpu-with-matlab-for-gpu-computing
https://www.mathworks.com/help/parallel-computing/gpu-computing-requirements.html
which explain that Matlab currently does not fully support Nvidia gpus with compute capability greater than 9.0.
This means that RTX 5090 (or any GPU based on the new Blackwell architecture) is not fully supported natively, but it can be enabled with forward compatibility as follows:
parallel.gpu.enableCUDAForwardCompatibility(1)
However, Matlab documentation also says that "Enabling forward compatibility can result in wrong answers and unexpected behavior during GPU computations." (please see second link posted above).
So I would like to ask users who own a NVIDIA RTX 50XX what is their experience and how well forward compatibility works in practice. This feedback will be quite useful because I am currently considering upgrading my GPU to a new 5090 but I wonder if I should wait a bit until a future realease provide full native support.
Thanks in advance for comments/feedback etc.!Dear users,
I have read a couple of very useful posts
https://www.mathworks.com/matlabcentral/answers/2173867-can-i-use-my-nvidia-blackwell-architecture-gpu-with-matlab-for-gpu-computing
https://www.mathworks.com/help/parallel-computing/gpu-computing-requirements.html
which explain that Matlab currently does not fully support Nvidia gpus with compute capability greater than 9.0.
This means that RTX 5090 (or any GPU based on the new Blackwell architecture) is not fully supported natively, but it can be enabled with forward compatibility as follows:
parallel.gpu.enableCUDAForwardCompatibility(1)
However, Matlab documentation also says that "Enabling forward compatibility can result in wrong answers and unexpected behavior during GPU computations." (please see second link posted above).
So I would like to ask users who own a NVIDIA RTX 50XX what is their experience and how well forward compatibility works in practice. This feedback will be quite useful because I am currently considering upgrading my GPU to a new 5090 but I wonder if I should wait a bit until a future realease provide full native support.
Thanks in advance for comments/feedback etc.! Dear users,
I have read a couple of very useful posts
https://www.mathworks.com/matlabcentral/answers/2173867-can-i-use-my-nvidia-blackwell-architecture-gpu-with-matlab-for-gpu-computing
https://www.mathworks.com/help/parallel-computing/gpu-computing-requirements.html
which explain that Matlab currently does not fully support Nvidia gpus with compute capability greater than 9.0.
This means that RTX 5090 (or any GPU based on the new Blackwell architecture) is not fully supported natively, but it can be enabled with forward compatibility as follows:
parallel.gpu.enableCUDAForwardCompatibility(1)
However, Matlab documentation also says that "Enabling forward compatibility can result in wrong answers and unexpected behavior during GPU computations." (please see second link posted above).
So I would like to ask users who own a NVIDIA RTX 50XX what is their experience and how well forward compatibility works in practice. This feedback will be quite useful because I am currently considering upgrading my GPU to a new 5090 but I wonder if I should wait a bit until a future realease provide full native support.
Thanks in advance for comments/feedback etc.! parallel computing toolbox, gpu, forward compatibility, blackwell MATLAB Answers — New Questions
Cannot query I2C bus speed
Hi,
I’m using a Raspberry Pi 5 with the fresh latest OS and the MATLAB Support Package for Raspberry Pi. Last week I made a simple visualisaztion for gyroscope through i2c and it worked nicely. But today I had problem with this error when i try to do raspi
mypi = raspi(‘192.168.0.212’, ‘admin’, ‘raspberry’);
Cannot query I2C bus speed.
Caused by:
Error using matlabshared.internal.ssh2client/execute
Error executing command "sudo cat /sys/module/i2c_bcm2708/parameters/baudrate". Details:
STDERR: cat: /sys/module/i2c_bcm2708/parameters/baudrate: No such file or directory
STDOUT:
So i looked everywhere, made a fresh OS install, flashed a bootloader. I tried enabling via GUI, raspi-config and matlab. Nothing worked. Interestingly when I disable i2c interface on pi I no longer get this error and can do things in matlab.
My /boot/config.txt correctly enables I2C and sets the baudrate:Hi,
I’m using a Raspberry Pi 5 with the fresh latest OS and the MATLAB Support Package for Raspberry Pi. Last week I made a simple visualisaztion for gyroscope through i2c and it worked nicely. But today I had problem with this error when i try to do raspi
mypi = raspi(‘192.168.0.212’, ‘admin’, ‘raspberry’);
Cannot query I2C bus speed.
Caused by:
Error using matlabshared.internal.ssh2client/execute
Error executing command "sudo cat /sys/module/i2c_bcm2708/parameters/baudrate". Details:
STDERR: cat: /sys/module/i2c_bcm2708/parameters/baudrate: No such file or directory
STDOUT:
So i looked everywhere, made a fresh OS install, flashed a bootloader. I tried enabling via GUI, raspi-config and matlab. Nothing worked. Interestingly when I disable i2c interface on pi I no longer get this error and can do things in matlab.
My /boot/config.txt correctly enables I2C and sets the baudrate: Hi,
I’m using a Raspberry Pi 5 with the fresh latest OS and the MATLAB Support Package for Raspberry Pi. Last week I made a simple visualisaztion for gyroscope through i2c and it worked nicely. But today I had problem with this error when i try to do raspi
mypi = raspi(‘192.168.0.212’, ‘admin’, ‘raspberry’);
Cannot query I2C bus speed.
Caused by:
Error using matlabshared.internal.ssh2client/execute
Error executing command "sudo cat /sys/module/i2c_bcm2708/parameters/baudrate". Details:
STDERR: cat: /sys/module/i2c_bcm2708/parameters/baudrate: No such file or directory
STDOUT:
So i looked everywhere, made a fresh OS install, flashed a bootloader. I tried enabling via GUI, raspi-config and matlab. Nothing worked. Interestingly when I disable i2c interface on pi I no longer get this error and can do things in matlab.
My /boot/config.txt correctly enables I2C and sets the baudrate: raspberry, i2c MATLAB Answers — New Questions
Plot vectors from the origin
I am learning matlab and trying to plot vectors. I defined V=[3;4] to represent 3x^+4y^ and attempt to display using plot(V) hoping to see a vector from origin to (3,4) but instead the graph shows a vector from (1,3) to (2,4). Is it a problem with my plotting settings or am I not using the correct script?I am learning matlab and trying to plot vectors. I defined V=[3;4] to represent 3x^+4y^ and attempt to display using plot(V) hoping to see a vector from origin to (3,4) but instead the graph shows a vector from (1,3) to (2,4). Is it a problem with my plotting settings or am I not using the correct script? I am learning matlab and trying to plot vectors. I defined V=[3;4] to represent 3x^+4y^ and attempt to display using plot(V) hoping to see a vector from origin to (3,4) but instead the graph shows a vector from (1,3) to (2,4). Is it a problem with my plotting settings or am I not using the correct script? plotting, linear algebra MATLAB Answers — New Questions
Trying to build a DHT11 block and keep getting this error in Simulink
Im trying to build this block but I get this error that I will provide below. I have followed exactly the steps from the matlab tutorials, so I have no idea what is the problem. Please if anyone knows I would appreciate the help.
C:/Users/user/DOCUME~1/MATLAB/R2024b/ArduinoStaticLibrary/ArduinoUno/FasterRuns/MW_RebuildSrc_Core.o -lm -lcomm -lcore DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_step’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_step+0xc0): undefined reference to `stepFunctionDHT11′ DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_initialize’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_initialize+0x5c): undefined reference to `setupFunctionDHT11′ collect2.exe: error: ld returned 1 exit status gmake[1]: *** [../DHT11_DDAppGeneratedModel.elf] Error 1 gmake[1]: Leaving directory `C:/Users/user/Desktop/DHT11/DHT11_DDAppGeneratedModel_ert_rtw’ gmake: *** [all] Error 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>echo The make command returned an error of 2 The make command returned an error of 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>exit /B 1 ### Build procedure for DHT11_DDAppGeneratedModel aborted due to an error.
Build Summary
Top model targets: Model Build Reason Status Build Duration ===================================================================================================================================================== DHT11_DDAppGeneratedModel Information cache folder or artifacts were missing. Failed to build. For more information, see build log. 0d 0 of 1 models built (0 models already up to date) Build duration: 0h 0m 29.469s
Error(s) encountered while building "DHT11_DDAppGeneratedModel"
Component:Simulink | Category:Block diagram error
And my code is as follows:
#include "C:UsersuserDesktopDHT11DHT11.h"
#include "Adafruit_Sensor.h"
#include "DHT.h"
#include "DHT_U.h"
#include "Arduino.h"
#define DHTPIN 10
#define DHTTYPE DHT11
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
void setupFunctiondht11Sensor(uint32_T * dataDelay,int size_vector__1){
Serial.begin(9600);
dht.begin();
delayMS = dataDelay;
}
void stepFunctiondht11Sensor(float * Humidity,int size_vector_1,float * Temperature,int size_vector_2){
delay(delayMS);
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature)) {
}
else {
*Temperature=event.temperature;
}
dht.humidity().getEvent(&event);
if (isnan(event.relative_humidity)) {
}
else {
*Humidity=event.relative_humidity;
}
}Im trying to build this block but I get this error that I will provide below. I have followed exactly the steps from the matlab tutorials, so I have no idea what is the problem. Please if anyone knows I would appreciate the help.
C:/Users/user/DOCUME~1/MATLAB/R2024b/ArduinoStaticLibrary/ArduinoUno/FasterRuns/MW_RebuildSrc_Core.o -lm -lcomm -lcore DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_step’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_step+0xc0): undefined reference to `stepFunctionDHT11′ DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_initialize’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_initialize+0x5c): undefined reference to `setupFunctionDHT11′ collect2.exe: error: ld returned 1 exit status gmake[1]: *** [../DHT11_DDAppGeneratedModel.elf] Error 1 gmake[1]: Leaving directory `C:/Users/user/Desktop/DHT11/DHT11_DDAppGeneratedModel_ert_rtw’ gmake: *** [all] Error 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>echo The make command returned an error of 2 The make command returned an error of 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>exit /B 1 ### Build procedure for DHT11_DDAppGeneratedModel aborted due to an error.
Build Summary
Top model targets: Model Build Reason Status Build Duration ===================================================================================================================================================== DHT11_DDAppGeneratedModel Information cache folder or artifacts were missing. Failed to build. For more information, see build log. 0d 0 of 1 models built (0 models already up to date) Build duration: 0h 0m 29.469s
Error(s) encountered while building "DHT11_DDAppGeneratedModel"
Component:Simulink | Category:Block diagram error
And my code is as follows:
#include "C:UsersuserDesktopDHT11DHT11.h"
#include "Adafruit_Sensor.h"
#include "DHT.h"
#include "DHT_U.h"
#include "Arduino.h"
#define DHTPIN 10
#define DHTTYPE DHT11
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
void setupFunctiondht11Sensor(uint32_T * dataDelay,int size_vector__1){
Serial.begin(9600);
dht.begin();
delayMS = dataDelay;
}
void stepFunctiondht11Sensor(float * Humidity,int size_vector_1,float * Temperature,int size_vector_2){
delay(delayMS);
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature)) {
}
else {
*Temperature=event.temperature;
}
dht.humidity().getEvent(&event);
if (isnan(event.relative_humidity)) {
}
else {
*Humidity=event.relative_humidity;
}
} Im trying to build this block but I get this error that I will provide below. I have followed exactly the steps from the matlab tutorials, so I have no idea what is the problem. Please if anyone knows I would appreciate the help.
C:/Users/user/DOCUME~1/MATLAB/R2024b/ArduinoStaticLibrary/ArduinoUno/FasterRuns/MW_RebuildSrc_Core.o -lm -lcomm -lcore DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_step’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_step+0xc0): undefined reference to `stepFunctionDHT11′ DHT11_DDAppGeneratedModel.o: In function `DHT11_DDAppGeneratedModel_initialize’: DHT11_DDAppGeneratedModel.c:(.text.DHT11_DDAppGeneratedModel_initialize+0x5c): undefined reference to `setupFunctionDHT11′ collect2.exe: error: ld returned 1 exit status gmake[1]: *** [../DHT11_DDAppGeneratedModel.elf] Error 1 gmake[1]: Leaving directory `C:/Users/user/Desktop/DHT11/DHT11_DDAppGeneratedModel_ert_rtw’ gmake: *** [all] Error 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>echo The make command returned an error of 2 The make command returned an error of 2 C:UsersuserDesktopDHT11DHT11_DDAppGeneratedModel_ert_rtw>exit /B 1 ### Build procedure for DHT11_DDAppGeneratedModel aborted due to an error.
Build Summary
Top model targets: Model Build Reason Status Build Duration ===================================================================================================================================================== DHT11_DDAppGeneratedModel Information cache folder or artifacts were missing. Failed to build. For more information, see build log. 0d 0 of 1 models built (0 models already up to date) Build duration: 0h 0m 29.469s
Error(s) encountered while building "DHT11_DDAppGeneratedModel"
Component:Simulink | Category:Block diagram error
And my code is as follows:
#include "C:UsersuserDesktopDHT11DHT11.h"
#include "Adafruit_Sensor.h"
#include "DHT.h"
#include "DHT_U.h"
#include "Arduino.h"
#define DHTPIN 10
#define DHTTYPE DHT11
DHT_Unified dht(DHTPIN, DHTTYPE);
uint32_t delayMS;
void setupFunctiondht11Sensor(uint32_T * dataDelay,int size_vector__1){
Serial.begin(9600);
dht.begin();
delayMS = dataDelay;
}
void stepFunctiondht11Sensor(float * Humidity,int size_vector_1,float * Temperature,int size_vector_2){
delay(delayMS);
sensors_event_t event;
dht.temperature().getEvent(&event);
if (isnan(event.temperature)) {
}
else {
*Temperature=event.temperature;
}
dht.humidity().getEvent(&event);
if (isnan(event.relative_humidity)) {
}
else {
*Humidity=event.relative_humidity;
}
} block diagram, error, simulink, dht11, code, c++ MATLAB Answers — New Questions
how to filter columns
Hello friends,
I have this script. But is very slow!
I want to filter all columns beginning with column first. After that, I want, in the place of column first, to put the second column and, in the place of column second to put the column first and filter again. And go on!
My purpose is decrease the time!
Thanks by support!
clear all
clc
q = 1;
p = 2;
r1 = 1;
r2 = 1;
tic
% Example: Filtering a matrix
load (‘tum.mat’); % tum have 576 x 1000
for i1 = 1:1000
% Filter rows where the first column is greater than 15
z1 = k2(k2(:,1) == 0, :);
s1 = sum(z1, 1);
r(r1,r2) = max(s1);
temp_row = k2(:,q);
k2(:,q) = k2(:,p);
k2(:,p) = temp_row;
p = p + 1;
r1 = r1 + 1;
end
toc
Elapsed time is 337.582496 seconds.Hello friends,
I have this script. But is very slow!
I want to filter all columns beginning with column first. After that, I want, in the place of column first, to put the second column and, in the place of column second to put the column first and filter again. And go on!
My purpose is decrease the time!
Thanks by support!
clear all
clc
q = 1;
p = 2;
r1 = 1;
r2 = 1;
tic
% Example: Filtering a matrix
load (‘tum.mat’); % tum have 576 x 1000
for i1 = 1:1000
% Filter rows where the first column is greater than 15
z1 = k2(k2(:,1) == 0, :);
s1 = sum(z1, 1);
r(r1,r2) = max(s1);
temp_row = k2(:,q);
k2(:,q) = k2(:,p);
k2(:,p) = temp_row;
p = p + 1;
r1 = r1 + 1;
end
toc
Elapsed time is 337.582496 seconds. Hello friends,
I have this script. But is very slow!
I want to filter all columns beginning with column first. After that, I want, in the place of column first, to put the second column and, in the place of column second to put the column first and filter again. And go on!
My purpose is decrease the time!
Thanks by support!
clear all
clc
q = 1;
p = 2;
r1 = 1;
r2 = 1;
tic
% Example: Filtering a matrix
load (‘tum.mat’); % tum have 576 x 1000
for i1 = 1:1000
% Filter rows where the first column is greater than 15
z1 = k2(k2(:,1) == 0, :);
s1 = sum(z1, 1);
r(r1,r2) = max(s1);
temp_row = k2(:,q);
k2(:,q) = k2(:,p);
k2(:,p) = temp_row;
p = p + 1;
r1 = r1 + 1;
end
toc
Elapsed time is 337.582496 seconds. filter columns MATLAB Answers — New Questions
ROS Commands hang/not working
Hello,
I am using R2025a, on Windows 11. I have installed the ROS toolbox, along with python 3.10.x.
Every time I issue a ros command, eg ros2node("/foo") or even ros2 node list, or whatever command in general, matlab hangs.
The program is not frozen, however it is as if the command never finishes execution. I’ve allowed for up to 30m of execution time, and I get nothing on the output window (and of course matlab is indicating "Busy").
The computer has all firewalls/antivirus software/whatnot completely disabled, so this must not be an issue here.
What I have tried:
1) Reinstall ROS addon
2) Try all three RMW implementations
In all cases, there was no difference in the outcome.
I’ve never seen this before, any ideas what it could be?
Thanks,
KonstantinosHello,
I am using R2025a, on Windows 11. I have installed the ROS toolbox, along with python 3.10.x.
Every time I issue a ros command, eg ros2node("/foo") or even ros2 node list, or whatever command in general, matlab hangs.
The program is not frozen, however it is as if the command never finishes execution. I’ve allowed for up to 30m of execution time, and I get nothing on the output window (and of course matlab is indicating "Busy").
The computer has all firewalls/antivirus software/whatnot completely disabled, so this must not be an issue here.
What I have tried:
1) Reinstall ROS addon
2) Try all three RMW implementations
In all cases, there was no difference in the outcome.
I’ve never seen this before, any ideas what it could be?
Thanks,
Konstantinos Hello,
I am using R2025a, on Windows 11. I have installed the ROS toolbox, along with python 3.10.x.
Every time I issue a ros command, eg ros2node("/foo") or even ros2 node list, or whatever command in general, matlab hangs.
The program is not frozen, however it is as if the command never finishes execution. I’ve allowed for up to 30m of execution time, and I get nothing on the output window (and of course matlab is indicating "Busy").
The computer has all firewalls/antivirus software/whatnot completely disabled, so this must not be an issue here.
What I have tried:
1) Reinstall ROS addon
2) Try all three RMW implementations
In all cases, there was no difference in the outcome.
I’ve never seen this before, any ideas what it could be?
Thanks,
Konstantinos ros MATLAB Answers — New Questions









