Category: Matlab
Category Archives: Matlab
Problem getting old desktop layout using 2025a
In old versions of MATLAB (pre 2025a) I could put the editor to the right of the command window, with the command window in the center of the screen (with things to its left). This no longer seems to be possible. Am I missing something? See below for old layout that I can’t reproduce.In old versions of MATLAB (pre 2025a) I could put the editor to the right of the command window, with the command window in the center of the screen (with things to its left). This no longer seems to be possible. Am I missing something? See below for old layout that I can’t reproduce. In old versions of MATLAB (pre 2025a) I could put the editor to the right of the command window, with the command window in the center of the screen (with things to its left). This no longer seems to be possible. Am I missing something? See below for old layout that I can’t reproduce. desktop MATLAB Answers — New Questions
Battery ECM in simscape does not allow pole reversal
I want to simulate deep discharge of battery. Deep discharge is needed before recycling. My simulation does not work because Battery ECM does not allow negative voltage. How can I solve the following errror?
Error:Error compiling Simscape network for model battery_model.
Caused by:
[‘battery_model/Battery Equivalent Circuit’]: Elements of Open-circuit voltage, OCV(SOC,T) must be greater than or equal to zero.I want to simulate deep discharge of battery. Deep discharge is needed before recycling. My simulation does not work because Battery ECM does not allow negative voltage. How can I solve the following errror?
Error:Error compiling Simscape network for model battery_model.
Caused by:
[‘battery_model/Battery Equivalent Circuit’]: Elements of Open-circuit voltage, OCV(SOC,T) must be greater than or equal to zero. I want to simulate deep discharge of battery. Deep discharge is needed before recycling. My simulation does not work because Battery ECM does not allow negative voltage. How can I solve the following errror?
Error:Error compiling Simscape network for model battery_model.
Caused by:
[‘battery_model/Battery Equivalent Circuit’]: Elements of Open-circuit voltage, OCV(SOC,T) must be greater than or equal to zero. simscape, battery MATLAB Answers — New Questions
How do I improve the speed of mdfRead()?
Hi everyone!
I’ve got a number of files with several gigabytes worth of data, broken down into tens of channel groups and in total hundreds of variables.
mdfRead() then, understandably, takes ages and does not function on lower spec devices.
Is there any way to improve how we use mdfRead? I’ve checked the documentation and see no obvious reason that it’s taking longer than, say for example, a CSV of the exact same data.
No data to share I’m afraid as strictly speaking it’s not mine to share
Thanks in advance :)Hi everyone!
I’ve got a number of files with several gigabytes worth of data, broken down into tens of channel groups and in total hundreds of variables.
mdfRead() then, understandably, takes ages and does not function on lower spec devices.
Is there any way to improve how we use mdfRead? I’ve checked the documentation and see no obvious reason that it’s taking longer than, say for example, a CSV of the exact same data.
No data to share I’m afraid as strictly speaking it’s not mine to share
Thanks in advance 🙂 Hi everyone!
I’ve got a number of files with several gigabytes worth of data, broken down into tens of channel groups and in total hundreds of variables.
mdfRead() then, understandably, takes ages and does not function on lower spec devices.
Is there any way to improve how we use mdfRead? I’ve checked the documentation and see no obvious reason that it’s taking longer than, say for example, a CSV of the exact same data.
No data to share I’m afraid as strictly speaking it’s not mine to share
Thanks in advance 🙂 automotive, matlab, mdfread() MATLAB Answers — New Questions
Compatability of runtime engine with matlab gui application
To Whom It May Concern;
I have Matlab 2023b installed on my Windows 11 laptop. I recentely installed the Matlab 2024b runtime engine in order to run a program someone else developed. Soe the 2023b version of Matlab use the runtime engine? I ask because of difficulties I am having running a piece of code.To Whom It May Concern;
I have Matlab 2023b installed on my Windows 11 laptop. I recentely installed the Matlab 2024b runtime engine in order to run a program someone else developed. Soe the 2023b version of Matlab use the runtime engine? I ask because of difficulties I am having running a piece of code. To Whom It May Concern;
I have Matlab 2023b installed on my Windows 11 laptop. I recentely installed the Matlab 2024b runtime engine in order to run a program someone else developed. Soe the 2023b version of Matlab use the runtime engine? I ask because of difficulties I am having running a piece of code. versions of runtime engine compatability MATLAB Answers — New Questions
Advanced vehicle simulator to Virtual Vehicle Composer
Hello,I am currently working on the virtual vehicle composer app provided by Matlab, and I was wondering what are the parameters that I have to change in order to get my VVC model to act the same as the (very primitive) advisor model. I have already calibrated the engine, transmission and TCU, however I believe that I have missed some parameters since the model doesn’t behave exactly the same. Thank you…Hello,I am currently working on the virtual vehicle composer app provided by Matlab, and I was wondering what are the parameters that I have to change in order to get my VVC model to act the same as the (very primitive) advisor model. I have already calibrated the engine, transmission and TCU, however I believe that I have missed some parameters since the model doesn’t behave exactly the same. Thank you… Hello,I am currently working on the virtual vehicle composer app provided by Matlab, and I was wondering what are the parameters that I have to change in order to get my VVC model to act the same as the (very primitive) advisor model. I have already calibrated the engine, transmission and TCU, however I believe that I have missed some parameters since the model doesn’t behave exactly the same. Thank you… virtualvehiclecomposer, automotive, advisor MATLAB Answers — New Questions
How can i build a ZIP Load with the use of Specialized Power System Library components?
I am trying to make a 3 phase polynomial load (ZIP Load) using the Specialized Power Systems components, but i have not been succesful. How would you suggest i do it? What components should i include?I am trying to make a 3 phase polynomial load (ZIP Load) using the Specialized Power Systems components, but i have not been succesful. How would you suggest i do it? What components should i include? I am trying to make a 3 phase polynomial load (ZIP Load) using the Specialized Power Systems components, but i have not been succesful. How would you suggest i do it? What components should i include? sps, simscape, zipload MATLAB Answers — New Questions
What is the friction coefficient value used in the Magic Tire Model in ADT Stanley Controller for an Autonomous Vehicle (Highway)?
I am simulating ADT Stanley Controller for an Autonomous Vehicle (Highway), and I would like to know what value is used for the friction coeffcient () in the implementation of ADT Stanley Controller for an Autonomous Vehicle (Highway). Can anybody help please?
Best, Kanat.I am simulating ADT Stanley Controller for an Autonomous Vehicle (Highway), and I would like to know what value is used for the friction coeffcient () in the implementation of ADT Stanley Controller for an Autonomous Vehicle (Highway). Can anybody help please?
Best, Kanat. I am simulating ADT Stanley Controller for an Autonomous Vehicle (Highway), and I would like to know what value is used for the friction coeffcient () in the implementation of ADT Stanley Controller for an Autonomous Vehicle (Highway). Can anybody help please?
Best, Kanat. vehicle dynamics modelling, friction coefficient MATLAB Answers — New Questions
Heatmap in uipanel resizing in normal mode but not when debugging
Hi,
I have created a grid layout ([3,2]) in a tab in a programmatical app. The column width for the grid layout is set to ‘fit’ for both columns. In the first row, I have a uitable and a uiaxes next to each other and in the second row, I have a uipanel and another uiaxes next to one another. The final row contains a button.
The content of the uipanel in the second row, is a heatmap based on the correlations between variables. I am using a uipanel as a parent since heatmap cannot be the child of uiaxes.
When I debug the code, the heatmap fills the uipanel perfectly and everything runs as expected. However, if I remove the breakpoints and run the code in normal mode, the heatmap resizes for some reason and becomes very small in the uipanel.
This is the code used to create the gridlayout:
g3=uigridlayout(tab3,[3 2]);
g3.RowHeight = {‘fit’,’fit’,’fit’};
g3.ColumnWidth = {‘fit’,’fit’};
testdata=array2table(zeros(13,4),"RowNames",variables,"VariableNames",{‘Variable 1′,’Variable 2′,’Variable 3′,’Variable 4’});
t14=uitable(g3,"Data",testdata);
t14.ColumnEditable = repelem(false,4);
t14.Layout.Row=1;
t14.Layout.Column=1;
s1=uistyle(HorizontalAlignment=’right’);
addStyle(t14,s1);
ax1=uiaxes(g3);
ax1.Layout.Row=1;
ax1.Layout.Column=2;
ax_heat=uipanel(g3);
ax_heat.Layout.Row=2;
ax_heat.Layout.Column=1;
ax_box=uiaxes(g3);
ax_box.Layout.Row=2;
ax_box.Layout.Column=2;
The heatmap is calculated and assigned to the uipanel as follows:
R=corr(Data);
hm=heatmap(ax_heat,variables, variables,R,’Colormap’,jet);
Is there a way to "force" the size of the heatmap to fill the entire uipanel?
Why is the behaviour different between debugging (perfect) and normal mode?
Thanks in advance!Hi,
I have created a grid layout ([3,2]) in a tab in a programmatical app. The column width for the grid layout is set to ‘fit’ for both columns. In the first row, I have a uitable and a uiaxes next to each other and in the second row, I have a uipanel and another uiaxes next to one another. The final row contains a button.
The content of the uipanel in the second row, is a heatmap based on the correlations between variables. I am using a uipanel as a parent since heatmap cannot be the child of uiaxes.
When I debug the code, the heatmap fills the uipanel perfectly and everything runs as expected. However, if I remove the breakpoints and run the code in normal mode, the heatmap resizes for some reason and becomes very small in the uipanel.
This is the code used to create the gridlayout:
g3=uigridlayout(tab3,[3 2]);
g3.RowHeight = {‘fit’,’fit’,’fit’};
g3.ColumnWidth = {‘fit’,’fit’};
testdata=array2table(zeros(13,4),"RowNames",variables,"VariableNames",{‘Variable 1′,’Variable 2′,’Variable 3′,’Variable 4’});
t14=uitable(g3,"Data",testdata);
t14.ColumnEditable = repelem(false,4);
t14.Layout.Row=1;
t14.Layout.Column=1;
s1=uistyle(HorizontalAlignment=’right’);
addStyle(t14,s1);
ax1=uiaxes(g3);
ax1.Layout.Row=1;
ax1.Layout.Column=2;
ax_heat=uipanel(g3);
ax_heat.Layout.Row=2;
ax_heat.Layout.Column=1;
ax_box=uiaxes(g3);
ax_box.Layout.Row=2;
ax_box.Layout.Column=2;
The heatmap is calculated and assigned to the uipanel as follows:
R=corr(Data);
hm=heatmap(ax_heat,variables, variables,R,’Colormap’,jet);
Is there a way to "force" the size of the heatmap to fill the entire uipanel?
Why is the behaviour different between debugging (perfect) and normal mode?
Thanks in advance! Hi,
I have created a grid layout ([3,2]) in a tab in a programmatical app. The column width for the grid layout is set to ‘fit’ for both columns. In the first row, I have a uitable and a uiaxes next to each other and in the second row, I have a uipanel and another uiaxes next to one another. The final row contains a button.
The content of the uipanel in the second row, is a heatmap based on the correlations between variables. I am using a uipanel as a parent since heatmap cannot be the child of uiaxes.
When I debug the code, the heatmap fills the uipanel perfectly and everything runs as expected. However, if I remove the breakpoints and run the code in normal mode, the heatmap resizes for some reason and becomes very small in the uipanel.
This is the code used to create the gridlayout:
g3=uigridlayout(tab3,[3 2]);
g3.RowHeight = {‘fit’,’fit’,’fit’};
g3.ColumnWidth = {‘fit’,’fit’};
testdata=array2table(zeros(13,4),"RowNames",variables,"VariableNames",{‘Variable 1′,’Variable 2′,’Variable 3′,’Variable 4’});
t14=uitable(g3,"Data",testdata);
t14.ColumnEditable = repelem(false,4);
t14.Layout.Row=1;
t14.Layout.Column=1;
s1=uistyle(HorizontalAlignment=’right’);
addStyle(t14,s1);
ax1=uiaxes(g3);
ax1.Layout.Row=1;
ax1.Layout.Column=2;
ax_heat=uipanel(g3);
ax_heat.Layout.Row=2;
ax_heat.Layout.Column=1;
ax_box=uiaxes(g3);
ax_box.Layout.Row=2;
ax_box.Layout.Column=2;
The heatmap is calculated and assigned to the uipanel as follows:
R=corr(Data);
hm=heatmap(ax_heat,variables, variables,R,’Colormap’,jet);
Is there a way to "force" the size of the heatmap to fill the entire uipanel?
Why is the behaviour different between debugging (perfect) and normal mode?
Thanks in advance! uipanel, uigridlayout, heatmap, debugging MATLAB Answers — New Questions
Error message when rim ‘plot’ or ‘imshow’, etc
Just updated from 2019a to 2025a, both on the same PC running Windows 10, with Inter(R) UHD Graphics 630, driver version 31.0.101.2134. Error appeared when testing, e.g. plot(randn(1, 64)):
Warning: Error in state of SceneNode.
Invalid type of input arguments (should be uint64)
Error using +
Invalid type of input arguments (should be uint64)
Error in matlab.graphics.interaction.graphicscontrol.InteractionsManager/registerInteraction
Error in matlab.graphics.interaction.interactioncontainers.BaseAxesInteractionContainer/createDefaultWebAxesInteractions
Error in matlab.graphics.interaction.interactioncontainers.CartesianAxesInteractionContainer/createDefaultWebAxesInteractions
Error in matlab.graphics.interaction.interactioncontainers.BaseAxesInteractionContainer/setupInteractions
Error in matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractionsOnAxes
Error in matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractionsInSync
Error in matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractions>@()matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractionsInSync(ax,is2dim,numDataSpaces)Just updated from 2019a to 2025a, both on the same PC running Windows 10, with Inter(R) UHD Graphics 630, driver version 31.0.101.2134. Error appeared when testing, e.g. plot(randn(1, 64)):
Warning: Error in state of SceneNode.
Invalid type of input arguments (should be uint64)
Error using +
Invalid type of input arguments (should be uint64)
Error in matlab.graphics.interaction.graphicscontrol.InteractionsManager/registerInteraction
Error in matlab.graphics.interaction.interactioncontainers.BaseAxesInteractionContainer/createDefaultWebAxesInteractions
Error in matlab.graphics.interaction.interactioncontainers.CartesianAxesInteractionContainer/createDefaultWebAxesInteractions
Error in matlab.graphics.interaction.interactioncontainers.BaseAxesInteractionContainer/setupInteractions
Error in matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractionsOnAxes
Error in matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractionsInSync
Error in matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractions>@()matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractionsInSync(ax,is2dim,numDataSpaces) Just updated from 2019a to 2025a, both on the same PC running Windows 10, with Inter(R) UHD Graphics 630, driver version 31.0.101.2134. Error appeared when testing, e.g. plot(randn(1, 64)):
Warning: Error in state of SceneNode.
Invalid type of input arguments (should be uint64)
Error using +
Invalid type of input arguments (should be uint64)
Error in matlab.graphics.interaction.graphicscontrol.InteractionsManager/registerInteraction
Error in matlab.graphics.interaction.interactioncontainers.BaseAxesInteractionContainer/createDefaultWebAxesInteractions
Error in matlab.graphics.interaction.interactioncontainers.CartesianAxesInteractionContainer/createDefaultWebAxesInteractions
Error in matlab.graphics.interaction.interactioncontainers.BaseAxesInteractionContainer/setupInteractions
Error in matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractionsOnAxes
Error in matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractionsInSync
Error in matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractions>@()matlab.graphics.interaction.internal.UnifiedAxesInteractions.createDefaultInteractionsInSync(ax,is2dim,numDataSpaces) plot, graphics engine error MATLAB Answers — New Questions
Can’t figure out what’s wrong with my code
One of the main problems is that there will never be a sign change on the interval so it’ll always execute the first part of the if statement. I commented out the err>errtol part for testing. I don’t know what i’m doing wrong for calculating using the bisection method. I have to use while loops.
% A scale is made with two springs, and when an object is attached to the
% two springs, the springs stretch and the ring at the end of the two
% springs is displaced downwards a distance x.
%
% The relationship between the weight of the object and the distance x is:
% W=(2k/l)(l-lo)(b+x)
% The initial spring length
% lo = sqrt(a^2+b^2)
% The stretched spring length
% l = sqrt(a^2+(b+x)^2)
% for the given scale a=8.0 in. b=5.0 m. and the spring constant k=16.0 lb/in.
% b=5.0 m.=196.85 in.
% Trying to find the deflection x.
%
% Have the user input lower and upper values of the starting
% interval (xl, xu), as well as the weight of the object
% Initialize the error tolerance (errtol)
% and the maximum number of iterations (maxiter)
%
% Check the interval to see if there’s a sign change
%
% while (iterations < maxiter) and (err > errtol)
% Calculate midpoint of the interval xr=(xl+xu)/2
% Calculate error estimate (err)
% Evaluate the function at the midpoint f(xr)
% If the sign of f(xr) is equal to the sign of f(xl)
% if f(xr)*f(xu)>0
% then xr becomes the new xl.
% else xr becomes the new xu.
% end while loop
%
% If err <= errtol
% then solution found, output result
% else display ‘root not found within tolerance
W = input(‘nWhat is the weight of the object attached to the ring in pounds (lb)? ‘);
xl = input(‘nWhat is the lower initial bracket estimate in inches? ‘); %always 0
xu = input(‘nWhat is the upper initial bracket estimate in inches? ‘); %always 10
a = 8.0;
b = 5.0 ;
lo = sqrt(a^2+b^2);
k = 16.0;
errtol = 0.005;
xr = (xl+xu)/2;
maxiter = 10;
iterations = 0;
f = @(x) (2*k/(sqrt(a^2+(b+x)^2)))*((sqrt(a^2+(b+x)^2))-lo)*(b+x);
err = abs((xu-xl)/xu);
xrold = abs((xu-xl)/xu);
while (iterations<maxiter) %|| (err>errtol)
iterations=iterations+1;
xr=(xl+xu)/2;
err = abs((xr-xrold)/xr)*100;
if f(xr)*f(xl)>0
xu = xr;
else
xl = xr;
end
xrold = xr;
endOne of the main problems is that there will never be a sign change on the interval so it’ll always execute the first part of the if statement. I commented out the err>errtol part for testing. I don’t know what i’m doing wrong for calculating using the bisection method. I have to use while loops.
% A scale is made with two springs, and when an object is attached to the
% two springs, the springs stretch and the ring at the end of the two
% springs is displaced downwards a distance x.
%
% The relationship between the weight of the object and the distance x is:
% W=(2k/l)(l-lo)(b+x)
% The initial spring length
% lo = sqrt(a^2+b^2)
% The stretched spring length
% l = sqrt(a^2+(b+x)^2)
% for the given scale a=8.0 in. b=5.0 m. and the spring constant k=16.0 lb/in.
% b=5.0 m.=196.85 in.
% Trying to find the deflection x.
%
% Have the user input lower and upper values of the starting
% interval (xl, xu), as well as the weight of the object
% Initialize the error tolerance (errtol)
% and the maximum number of iterations (maxiter)
%
% Check the interval to see if there’s a sign change
%
% while (iterations < maxiter) and (err > errtol)
% Calculate midpoint of the interval xr=(xl+xu)/2
% Calculate error estimate (err)
% Evaluate the function at the midpoint f(xr)
% If the sign of f(xr) is equal to the sign of f(xl)
% if f(xr)*f(xu)>0
% then xr becomes the new xl.
% else xr becomes the new xu.
% end while loop
%
% If err <= errtol
% then solution found, output result
% else display ‘root not found within tolerance
W = input(‘nWhat is the weight of the object attached to the ring in pounds (lb)? ‘);
xl = input(‘nWhat is the lower initial bracket estimate in inches? ‘); %always 0
xu = input(‘nWhat is the upper initial bracket estimate in inches? ‘); %always 10
a = 8.0;
b = 5.0 ;
lo = sqrt(a^2+b^2);
k = 16.0;
errtol = 0.005;
xr = (xl+xu)/2;
maxiter = 10;
iterations = 0;
f = @(x) (2*k/(sqrt(a^2+(b+x)^2)))*((sqrt(a^2+(b+x)^2))-lo)*(b+x);
err = abs((xu-xl)/xu);
xrold = abs((xu-xl)/xu);
while (iterations<maxiter) %|| (err>errtol)
iterations=iterations+1;
xr=(xl+xu)/2;
err = abs((xr-xrold)/xr)*100;
if f(xr)*f(xl)>0
xu = xr;
else
xl = xr;
end
xrold = xr;
end One of the main problems is that there will never be a sign change on the interval so it’ll always execute the first part of the if statement. I commented out the err>errtol part for testing. I don’t know what i’m doing wrong for calculating using the bisection method. I have to use while loops.
% A scale is made with two springs, and when an object is attached to the
% two springs, the springs stretch and the ring at the end of the two
% springs is displaced downwards a distance x.
%
% The relationship between the weight of the object and the distance x is:
% W=(2k/l)(l-lo)(b+x)
% The initial spring length
% lo = sqrt(a^2+b^2)
% The stretched spring length
% l = sqrt(a^2+(b+x)^2)
% for the given scale a=8.0 in. b=5.0 m. and the spring constant k=16.0 lb/in.
% b=5.0 m.=196.85 in.
% Trying to find the deflection x.
%
% Have the user input lower and upper values of the starting
% interval (xl, xu), as well as the weight of the object
% Initialize the error tolerance (errtol)
% and the maximum number of iterations (maxiter)
%
% Check the interval to see if there’s a sign change
%
% while (iterations < maxiter) and (err > errtol)
% Calculate midpoint of the interval xr=(xl+xu)/2
% Calculate error estimate (err)
% Evaluate the function at the midpoint f(xr)
% If the sign of f(xr) is equal to the sign of f(xl)
% if f(xr)*f(xu)>0
% then xr becomes the new xl.
% else xr becomes the new xu.
% end while loop
%
% If err <= errtol
% then solution found, output result
% else display ‘root not found within tolerance
W = input(‘nWhat is the weight of the object attached to the ring in pounds (lb)? ‘);
xl = input(‘nWhat is the lower initial bracket estimate in inches? ‘); %always 0
xu = input(‘nWhat is the upper initial bracket estimate in inches? ‘); %always 10
a = 8.0;
b = 5.0 ;
lo = sqrt(a^2+b^2);
k = 16.0;
errtol = 0.005;
xr = (xl+xu)/2;
maxiter = 10;
iterations = 0;
f = @(x) (2*k/(sqrt(a^2+(b+x)^2)))*((sqrt(a^2+(b+x)^2))-lo)*(b+x);
err = abs((xu-xl)/xu);
xrold = abs((xu-xl)/xu);
while (iterations<maxiter) %|| (err>errtol)
iterations=iterations+1;
xr=(xl+xu)/2;
err = abs((xr-xrold)/xr)*100;
if f(xr)*f(xl)>0
xu = xr;
else
xl = xr;
end
xrold = xr;
end bisection, while loop MATLAB Answers — New Questions
Error in parallel pool
parpool(‘local’, numWorkers);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Caused by:
Error using
parallel.internal.pool.SpfClientSession
Failed to open any port in the range [27370
28370]. Verify that at least one port is
available in this range and not in use by
another process on this machine. Cause:
Failed to bind to ::1:28370 with error:
Cannot assign requested address.parpool(‘local’, numWorkers);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Caused by:
Error using
parallel.internal.pool.SpfClientSession
Failed to open any port in the range [27370
28370]. Verify that at least one port is
available in this range and not in use by
another process on this machine. Cause:
Failed to bind to ::1:28370 with error:
Cannot assign requested address. parpool(‘local’, numWorkers);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Caused by:
Error using
parallel.internal.pool.SpfClientSession
Failed to open any port in the range [27370
28370]. Verify that at least one port is
available in this range and not in use by
another process on this machine. Cause:
Failed to bind to ::1:28370 with error:
Cannot assign requested address. parfor MATLAB Answers — New Questions
How to create a GUI in App Designer starting from existing code
I am attempting to use AI to generate an initial design for a GUI. I would like to copy the code that is generated and input it directly into the Code View of the App Designer. I would then like to make further adjustments using some of the App Designer tools (i.e. Design View). However, I cannot copy the code directly over, as App Designer doesn’t let the user edit portions of the code. Is there a way to edit the grayed-out code? Or a way to easily integrate the generated code into an .mlapp file?I am attempting to use AI to generate an initial design for a GUI. I would like to copy the code that is generated and input it directly into the Code View of the App Designer. I would then like to make further adjustments using some of the App Designer tools (i.e. Design View). However, I cannot copy the code directly over, as App Designer doesn’t let the user edit portions of the code. Is there a way to edit the grayed-out code? Or a way to easily integrate the generated code into an .mlapp file? I am attempting to use AI to generate an initial design for a GUI. I would like to copy the code that is generated and input it directly into the Code View of the App Designer. I would then like to make further adjustments using some of the App Designer tools (i.e. Design View). However, I cannot copy the code directly over, as App Designer doesn’t let the user edit portions of the code. Is there a way to edit the grayed-out code? Or a way to easily integrate the generated code into an .mlapp file? appdesigner, app designer MATLAB Answers — New Questions
Plot not showing the desired markers and does not match the legend
Hello everyone,
I am trying to plot theta vs Cp. Cp here is calculated based on the function provided. However when plotted, the markers are not showing properly and does not match the legend.
Any help is appreciated!
I have attached the plot as well as the function and the main file.
Function File:
function Cp = Experiment_1(H,Ch11)
cu = 9.8; %mm of H20 to Pascal
%H=[-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11 = Ch11.*cu; % Converting channel 11 pressure to Pascal
for i=1:length(H)
H(i) = H(i).*cu; % To convert to Pascal
end
% Convert pressure readings to total pressure
P_atm = 99991.7925; % Pascal
for i=1:length(H)
Pt(i) = P_atm + H(i);
end
Ch11 = P_atm + Ch11;
% theta
theta = linspace(0,180,10);
% Generate the plot for total pressure
%{
plot(theta,Pt, ‘o’, ‘MarkerSize’, 5, ‘MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
xlabel("$theta[degrees]$","Interpreter","latex","FontSize",12)
ylabel("$Total Pressure, P_{o}[atm]$","Interpreter","latex","FontSize",12)
grid on
axis equal
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
%}
% Calculation of Cp experimental
Cp = (Pt- Ch11)./((1.0/2.0)*1.225*6.4*6.4);
% Plot the Cp along the circular cylinder
plot(theta, Cp, ‘-d’, ‘MarkerSize’,5,’MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
hold on
plot(theta, Cp, ‘-o’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-+’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-*’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-x’, ‘MarkerSize’,5)
xlabel(‘$theta [^circ]$’,"Interpreter","latex","FontSize",12)
ylabel(‘$C_p$’,"Interpreter","latex","FontSize",12)
grid on
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
legend("V=6.4 m/s", "V = 8.7 m/s" , "V = 11 m/s" , "V = 14.3 m/s", "V=12.1 m/s","Interpreter","latex")
%%
sfname = "C:IITM MATLABLAB AS5110Images";
export_fig(strcat(sfname,’Cp20Fan’),’-png’,’-transparent’,’-m4′);
Main File:
figure;
hold on;
H20 = [-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11_1 = -2.1;
H30 = [-0.3,-1.2,-4.5,-7.4,-7.5,-7.1,-6.9,-7.0,-7.0,-6.5];
Ch11_2 = -4.1;
H40 = [-0.3,-2.2,-7.5,-12.5,-12.4,-11.9,-11.8,-12.3,-12.1,-11.4];
Ch11_3 = -7.0;
H45 = [-0.5,-2.7,-9.4,-15.6,-15.6,-14.8,-14.8,-15.1,-15.0,-14.4];
Ch11_4 = -8.7;
H55 = [-0.5,-3.9,-13.4,-22.4,-22.0,-21.1,-21.0,-21.8,-21.6,-20.9];
Ch11_5 = -12.2;
Cp20 = Experiment_1(H20, Ch11_1);
Cp30 = Experiment_1(H30, Ch11_2);
Cp40 = Experiment_1(H40, Ch11_3);
Cp45 = Experiment_1(H45, Ch11_4);
Cp55 = Experiment_1(H55, Ch11_5);Hello everyone,
I am trying to plot theta vs Cp. Cp here is calculated based on the function provided. However when plotted, the markers are not showing properly and does not match the legend.
Any help is appreciated!
I have attached the plot as well as the function and the main file.
Function File:
function Cp = Experiment_1(H,Ch11)
cu = 9.8; %mm of H20 to Pascal
%H=[-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11 = Ch11.*cu; % Converting channel 11 pressure to Pascal
for i=1:length(H)
H(i) = H(i).*cu; % To convert to Pascal
end
% Convert pressure readings to total pressure
P_atm = 99991.7925; % Pascal
for i=1:length(H)
Pt(i) = P_atm + H(i);
end
Ch11 = P_atm + Ch11;
% theta
theta = linspace(0,180,10);
% Generate the plot for total pressure
%{
plot(theta,Pt, ‘o’, ‘MarkerSize’, 5, ‘MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
xlabel("$theta[degrees]$","Interpreter","latex","FontSize",12)
ylabel("$Total Pressure, P_{o}[atm]$","Interpreter","latex","FontSize",12)
grid on
axis equal
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
%}
% Calculation of Cp experimental
Cp = (Pt- Ch11)./((1.0/2.0)*1.225*6.4*6.4);
% Plot the Cp along the circular cylinder
plot(theta, Cp, ‘-d’, ‘MarkerSize’,5,’MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
hold on
plot(theta, Cp, ‘-o’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-+’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-*’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-x’, ‘MarkerSize’,5)
xlabel(‘$theta [^circ]$’,"Interpreter","latex","FontSize",12)
ylabel(‘$C_p$’,"Interpreter","latex","FontSize",12)
grid on
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
legend("V=6.4 m/s", "V = 8.7 m/s" , "V = 11 m/s" , "V = 14.3 m/s", "V=12.1 m/s","Interpreter","latex")
%%
sfname = "C:IITM MATLABLAB AS5110Images";
export_fig(strcat(sfname,’Cp20Fan’),’-png’,’-transparent’,’-m4′);
Main File:
figure;
hold on;
H20 = [-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11_1 = -2.1;
H30 = [-0.3,-1.2,-4.5,-7.4,-7.5,-7.1,-6.9,-7.0,-7.0,-6.5];
Ch11_2 = -4.1;
H40 = [-0.3,-2.2,-7.5,-12.5,-12.4,-11.9,-11.8,-12.3,-12.1,-11.4];
Ch11_3 = -7.0;
H45 = [-0.5,-2.7,-9.4,-15.6,-15.6,-14.8,-14.8,-15.1,-15.0,-14.4];
Ch11_4 = -8.7;
H55 = [-0.5,-3.9,-13.4,-22.4,-22.0,-21.1,-21.0,-21.8,-21.6,-20.9];
Ch11_5 = -12.2;
Cp20 = Experiment_1(H20, Ch11_1);
Cp30 = Experiment_1(H30, Ch11_2);
Cp40 = Experiment_1(H40, Ch11_3);
Cp45 = Experiment_1(H45, Ch11_4);
Cp55 = Experiment_1(H55, Ch11_5); Hello everyone,
I am trying to plot theta vs Cp. Cp here is calculated based on the function provided. However when plotted, the markers are not showing properly and does not match the legend.
Any help is appreciated!
I have attached the plot as well as the function and the main file.
Function File:
function Cp = Experiment_1(H,Ch11)
cu = 9.8; %mm of H20 to Pascal
%H=[-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11 = Ch11.*cu; % Converting channel 11 pressure to Pascal
for i=1:length(H)
H(i) = H(i).*cu; % To convert to Pascal
end
% Convert pressure readings to total pressure
P_atm = 99991.7925; % Pascal
for i=1:length(H)
Pt(i) = P_atm + H(i);
end
Ch11 = P_atm + Ch11;
% theta
theta = linspace(0,180,10);
% Generate the plot for total pressure
%{
plot(theta,Pt, ‘o’, ‘MarkerSize’, 5, ‘MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
xlabel("$theta[degrees]$","Interpreter","latex","FontSize",12)
ylabel("$Total Pressure, P_{o}[atm]$","Interpreter","latex","FontSize",12)
grid on
axis equal
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
%}
% Calculation of Cp experimental
Cp = (Pt- Ch11)./((1.0/2.0)*1.225*6.4*6.4);
% Plot the Cp along the circular cylinder
plot(theta, Cp, ‘-d’, ‘MarkerSize’,5,’MarkerEdgeColor’, ‘r’, ‘MarkerFaceColor’, ‘g’);
hold on
plot(theta, Cp, ‘-o’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-+’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-*’, ‘MarkerSize’,5)
hold on
plot(theta, Cp, ‘-x’, ‘MarkerSize’,5)
xlabel(‘$theta [^circ]$’,"Interpreter","latex","FontSize",12)
ylabel(‘$C_p$’,"Interpreter","latex","FontSize",12)
grid on
set(gca,’TickLabelInterpreter’,’latex’,’layer’,’top’);
set(gca,’TickDir’,’out’)
set(gca, ‘Layer’, ‘bottom’)
legend("V=6.4 m/s", "V = 8.7 m/s" , "V = 11 m/s" , "V = 14.3 m/s", "V=12.1 m/s","Interpreter","latex")
%%
sfname = "C:IITM MATLABLAB AS5110Images";
export_fig(strcat(sfname,’Cp20Fan’),’-png’,’-transparent’,’-m4′);
Main File:
figure;
hold on;
H20 = [-0.3,-0.5,-2.1,-3.3,-3.5,-3.2,-3.1,-3.1,-3.2,-2.7];
Ch11_1 = -2.1;
H30 = [-0.3,-1.2,-4.5,-7.4,-7.5,-7.1,-6.9,-7.0,-7.0,-6.5];
Ch11_2 = -4.1;
H40 = [-0.3,-2.2,-7.5,-12.5,-12.4,-11.9,-11.8,-12.3,-12.1,-11.4];
Ch11_3 = -7.0;
H45 = [-0.5,-2.7,-9.4,-15.6,-15.6,-14.8,-14.8,-15.1,-15.0,-14.4];
Ch11_4 = -8.7;
H55 = [-0.5,-3.9,-13.4,-22.4,-22.0,-21.1,-21.0,-21.8,-21.6,-20.9];
Ch11_5 = -12.2;
Cp20 = Experiment_1(H20, Ch11_1);
Cp30 = Experiment_1(H30, Ch11_2);
Cp40 = Experiment_1(H40, Ch11_3);
Cp45 = Experiment_1(H45, Ch11_4);
Cp55 = Experiment_1(H55, Ch11_5); matlab, plot, markers, legend MATLAB Answers — New Questions
Triangular-weighted moving average filter
Hi,
I`m looking for function or source code for Triangular-weighted moving average filter to apply it and make my data processing.
High-frequency noise shall be removed from the measured signals using a triangular-weighted moving average with a smoothing width of 100 ms.
can someone share the experience ?Hi,
I`m looking for function or source code for Triangular-weighted moving average filter to apply it and make my data processing.
High-frequency noise shall be removed from the measured signals using a triangular-weighted moving average with a smoothing width of 100 ms.
can someone share the experience ? Hi,
I`m looking for function or source code for Triangular-weighted moving average filter to apply it and make my data processing.
High-frequency noise shall be removed from the measured signals using a triangular-weighted moving average with a smoothing width of 100 ms.
can someone share the experience ? filter, data processing MATLAB Answers — New Questions
MATLAB’s inefficient copy-on-write implementation
MATLAB’s copy-on-write memory management seems to have a serious defect, which I think is the reason behind the abysmal performance of subsasgn overloading. (The same problem probably occurs with parenAssign in the new R2021b RedefinesParen class — I haven’t yet experimented with it.) Normally, an array assignment like b = a simply does a pointer copy; the array data is not copied until b is modified (e.g. b(1) = 1). Thereafter, subsequent modification of b (e.g. b(2) = 1) do not copy the full array; they just modify it in place as long as the reference count is 1. For example,
clear, a = zeros(1e8,1);
memory % 2764 MB used by MATLAB
b = a;
memory % 2764 MB
tic, b(1) = 1; toc, memory % 0.329099 seconds, 3540 MB
tic, b(2) = 1; toc, memory % 0.000123 seconds, 3541 MB
However, the benefit of copy-on-write is lost when the variable is changed in a function, e.g.
% test.m
function x = test(x)
x(1) = 1;
In this case, the x reference count is apparently incremented in test before the assignment is made, so this will always result in a full array copy. For example,
clear, a = zeros(1e8,1);
tic, a = test(a); toc % 0.337475 seconds
tic, a = test(a); toc % 0.310373 seconds
To see what’s happening with copy-on-write, test.m is modified as follows:
function x = test(x)
memory
x(1) = 1;
memory
return
The array modification inside the function forces a full array copy, even though the original array is immediately discarded:
clear, a = zeros(1e8,1);
memory % 2748 MB
a = test(a); % 2748 MB, 3503 MB
memory % 2740 MB
I would think this problem could be easily avoided by treating any variable that appears as both an input and output argument in a function (e.g. function x = test(x)) as a reference variable, i.e. its reference count is not incremented on entering the function and is not decremented upon exiting. If the function is called with different input and output arguments, e.g. y = test(x), then the interpreter would implement this as y = x; y = test(y).
Is there any particular reason why MATLAB does not or cannot do this? There are many applications such as subasgn overloading that could see a big performance boost if this problem is fixed.MATLAB’s copy-on-write memory management seems to have a serious defect, which I think is the reason behind the abysmal performance of subsasgn overloading. (The same problem probably occurs with parenAssign in the new R2021b RedefinesParen class — I haven’t yet experimented with it.) Normally, an array assignment like b = a simply does a pointer copy; the array data is not copied until b is modified (e.g. b(1) = 1). Thereafter, subsequent modification of b (e.g. b(2) = 1) do not copy the full array; they just modify it in place as long as the reference count is 1. For example,
clear, a = zeros(1e8,1);
memory % 2764 MB used by MATLAB
b = a;
memory % 2764 MB
tic, b(1) = 1; toc, memory % 0.329099 seconds, 3540 MB
tic, b(2) = 1; toc, memory % 0.000123 seconds, 3541 MB
However, the benefit of copy-on-write is lost when the variable is changed in a function, e.g.
% test.m
function x = test(x)
x(1) = 1;
In this case, the x reference count is apparently incremented in test before the assignment is made, so this will always result in a full array copy. For example,
clear, a = zeros(1e8,1);
tic, a = test(a); toc % 0.337475 seconds
tic, a = test(a); toc % 0.310373 seconds
To see what’s happening with copy-on-write, test.m is modified as follows:
function x = test(x)
memory
x(1) = 1;
memory
return
The array modification inside the function forces a full array copy, even though the original array is immediately discarded:
clear, a = zeros(1e8,1);
memory % 2748 MB
a = test(a); % 2748 MB, 3503 MB
memory % 2740 MB
I would think this problem could be easily avoided by treating any variable that appears as both an input and output argument in a function (e.g. function x = test(x)) as a reference variable, i.e. its reference count is not incremented on entering the function and is not decremented upon exiting. If the function is called with different input and output arguments, e.g. y = test(x), then the interpreter would implement this as y = x; y = test(y).
Is there any particular reason why MATLAB does not or cannot do this? There are many applications such as subasgn overloading that could see a big performance boost if this problem is fixed. MATLAB’s copy-on-write memory management seems to have a serious defect, which I think is the reason behind the abysmal performance of subsasgn overloading. (The same problem probably occurs with parenAssign in the new R2021b RedefinesParen class — I haven’t yet experimented with it.) Normally, an array assignment like b = a simply does a pointer copy; the array data is not copied until b is modified (e.g. b(1) = 1). Thereafter, subsequent modification of b (e.g. b(2) = 1) do not copy the full array; they just modify it in place as long as the reference count is 1. For example,
clear, a = zeros(1e8,1);
memory % 2764 MB used by MATLAB
b = a;
memory % 2764 MB
tic, b(1) = 1; toc, memory % 0.329099 seconds, 3540 MB
tic, b(2) = 1; toc, memory % 0.000123 seconds, 3541 MB
However, the benefit of copy-on-write is lost when the variable is changed in a function, e.g.
% test.m
function x = test(x)
x(1) = 1;
In this case, the x reference count is apparently incremented in test before the assignment is made, so this will always result in a full array copy. For example,
clear, a = zeros(1e8,1);
tic, a = test(a); toc % 0.337475 seconds
tic, a = test(a); toc % 0.310373 seconds
To see what’s happening with copy-on-write, test.m is modified as follows:
function x = test(x)
memory
x(1) = 1;
memory
return
The array modification inside the function forces a full array copy, even though the original array is immediately discarded:
clear, a = zeros(1e8,1);
memory % 2748 MB
a = test(a); % 2748 MB, 3503 MB
memory % 2740 MB
I would think this problem could be easily avoided by treating any variable that appears as both an input and output argument in a function (e.g. function x = test(x)) as a reference variable, i.e. its reference count is not incremented on entering the function and is not decremented upon exiting. If the function is called with different input and output arguments, e.g. y = test(x), then the interpreter would implement this as y = x; y = test(y).
Is there any particular reason why MATLAB does not or cannot do this? There are many applications such as subasgn overloading that could see a big performance boost if this problem is fixed. memory management, copy-on-write, subsasgn, parenassign MATLAB Answers — New Questions
Getting rid of IntCon in GA
I have code for a genetic algorithm as follows (which I got from a matlab example):
[x,fval] = ga(@objfun,4,A,b,Aeq,beq,lb,ub,@nonlcon, [1,2])
the [1,2] parameter corresponds to IntCon (see https://www.mathworks.com/help/gads/ga.html#d122e40769), and it is restricting x(1) and x(2) to integer values (which I don’t want). I want to get rid of this but when I delete it and run:
[x,fval] = ga(@objfun,4,A,b,Aeq,beq,lb,ub,@nonlcon)
I get this error:
Error using constrValidate (line 59)
Constraint function must return real value.
Error in gacommon (line 125)
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, …
Error in ga (line 364)
NonconFcn,options,Iterate,type] = gacommon(nvars,fun,Aineq,bineq,Aeq,beq,lb,ub, …
Error in Model_Building_2 (line 101)
[x,fval] = ga(@objfun,4,A,b,Aeq,beq,lb,ub,@nonlcon)
can anyone think of any reason why this happens? the code runs well with any variable in IntCon (ie it can be [3], [4], [2,3] or any other combination) as long as there is at least one. using empty brackets [] returns the same error as above.
thanks in advance!I have code for a genetic algorithm as follows (which I got from a matlab example):
[x,fval] = ga(@objfun,4,A,b,Aeq,beq,lb,ub,@nonlcon, [1,2])
the [1,2] parameter corresponds to IntCon (see https://www.mathworks.com/help/gads/ga.html#d122e40769), and it is restricting x(1) and x(2) to integer values (which I don’t want). I want to get rid of this but when I delete it and run:
[x,fval] = ga(@objfun,4,A,b,Aeq,beq,lb,ub,@nonlcon)
I get this error:
Error using constrValidate (line 59)
Constraint function must return real value.
Error in gacommon (line 125)
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, …
Error in ga (line 364)
NonconFcn,options,Iterate,type] = gacommon(nvars,fun,Aineq,bineq,Aeq,beq,lb,ub, …
Error in Model_Building_2 (line 101)
[x,fval] = ga(@objfun,4,A,b,Aeq,beq,lb,ub,@nonlcon)
can anyone think of any reason why this happens? the code runs well with any variable in IntCon (ie it can be [3], [4], [2,3] or any other combination) as long as there is at least one. using empty brackets [] returns the same error as above.
thanks in advance! I have code for a genetic algorithm as follows (which I got from a matlab example):
[x,fval] = ga(@objfun,4,A,b,Aeq,beq,lb,ub,@nonlcon, [1,2])
the [1,2] parameter corresponds to IntCon (see https://www.mathworks.com/help/gads/ga.html#d122e40769), and it is restricting x(1) and x(2) to integer values (which I don’t want). I want to get rid of this but when I delete it and run:
[x,fval] = ga(@objfun,4,A,b,Aeq,beq,lb,ub,@nonlcon)
I get this error:
Error using constrValidate (line 59)
Constraint function must return real value.
Error in gacommon (line 125)
[LinearConstr, Iterate,nineqcstr,neqcstr,ncstr] = constrValidate(NonconFcn, …
Error in ga (line 364)
NonconFcn,options,Iterate,type] = gacommon(nvars,fun,Aineq,bineq,Aeq,beq,lb,ub, …
Error in Model_Building_2 (line 101)
[x,fval] = ga(@objfun,4,A,b,Aeq,beq,lb,ub,@nonlcon)
can anyone think of any reason why this happens? the code runs well with any variable in IntCon (ie it can be [3], [4], [2,3] or any other combination) as long as there is at least one. using empty brackets [] returns the same error as above.
thanks in advance! genetic algorithm, ga, optimization, global optimization, optimisation, intcon MATLAB Answers — New Questions
Inquiry on Time Complexity of cumsum
Hello,
My name is Asaro Hong, an M.S. student in Mechanical Engineering at Inha University.
In P2D lithium-ion battery model calculations, I frequently use cumsum on 1D vectors. I’d like to confirm the following:
What is the time complexity (Big-O) of cumsum with respect to input length n?
With Parallel Computing Toolbox or when using GPU arrays (gpuArray), are there documented differences in time complexity or constant factors/overhead?
For citation in a paper, could you point me to any official references (product documentation, technical notes, benchmark materials, etc.)?
Environment: MATLAB R2024a, Windows 10
Thank you for your help.Hello,
My name is Asaro Hong, an M.S. student in Mechanical Engineering at Inha University.
In P2D lithium-ion battery model calculations, I frequently use cumsum on 1D vectors. I’d like to confirm the following:
What is the time complexity (Big-O) of cumsum with respect to input length n?
With Parallel Computing Toolbox or when using GPU arrays (gpuArray), are there documented differences in time complexity or constant factors/overhead?
For citation in a paper, could you point me to any official references (product documentation, technical notes, benchmark materials, etc.)?
Environment: MATLAB R2024a, Windows 10
Thank you for your help. Hello,
My name is Asaro Hong, an M.S. student in Mechanical Engineering at Inha University.
In P2D lithium-ion battery model calculations, I frequently use cumsum on 1D vectors. I’d like to confirm the following:
What is the time complexity (Big-O) of cumsum with respect to input length n?
With Parallel Computing Toolbox or when using GPU arrays (gpuArray), are there documented differences in time complexity or constant factors/overhead?
For citation in a paper, could you point me to any official references (product documentation, technical notes, benchmark materials, etc.)?
Environment: MATLAB R2024a, Windows 10
Thank you for your help. algorithm MATLAB Answers — New Questions
Use string to define variable
Hello guys!
I am looking for a way to name a variable with a string name that will be changing according to the T and V values
My code is the following:
——————————-
T=15; % input variable T
V=1; % input variable V
load(‘FRF_T15_V1.mat’)
load(‘FRF_T15_V2.mat’)
load(‘FRF_T15_V3.mat’)
formatSpec = ‘FRF_T%d_V%d’;
filename = sprintf(formatSpec,T,V);
x=eval(filename);
XP=(x{3,3});
save (‘XP,’XP’)
—————————–
I would like for variable XP to be assigned according to the input values of T and V, e.g.,
FRF_T15_V1_XP=(x{3,3});
And then save it as
save (‘ FRF_T15_V1_XP,’ FRF_T15_V1_XP ‘)
Thanks in advance for your help!
Kind regards,
HugoHello guys!
I am looking for a way to name a variable with a string name that will be changing according to the T and V values
My code is the following:
——————————-
T=15; % input variable T
V=1; % input variable V
load(‘FRF_T15_V1.mat’)
load(‘FRF_T15_V2.mat’)
load(‘FRF_T15_V3.mat’)
formatSpec = ‘FRF_T%d_V%d’;
filename = sprintf(formatSpec,T,V);
x=eval(filename);
XP=(x{3,3});
save (‘XP,’XP’)
—————————–
I would like for variable XP to be assigned according to the input values of T and V, e.g.,
FRF_T15_V1_XP=(x{3,3});
And then save it as
save (‘ FRF_T15_V1_XP,’ FRF_T15_V1_XP ‘)
Thanks in advance for your help!
Kind regards,
Hugo Hello guys!
I am looking for a way to name a variable with a string name that will be changing according to the T and V values
My code is the following:
——————————-
T=15; % input variable T
V=1; % input variable V
load(‘FRF_T15_V1.mat’)
load(‘FRF_T15_V2.mat’)
load(‘FRF_T15_V3.mat’)
formatSpec = ‘FRF_T%d_V%d’;
filename = sprintf(formatSpec,T,V);
x=eval(filename);
XP=(x{3,3});
save (‘XP,’XP’)
—————————–
I would like for variable XP to be assigned according to the input values of T and V, e.g.,
FRF_T15_V1_XP=(x{3,3});
And then save it as
save (‘ FRF_T15_V1_XP,’ FRF_T15_V1_XP ‘)
Thanks in advance for your help!
Kind regards,
Hugo string, variable MATLAB Answers — New Questions
ROS2 communication between docker container and Matlab.
Hello,
I followed this guide to set up a docker container to run gazebo: https://www.mathworks.com/help/ros/ug/install-and-set-up-docker-for-ros-2-and-gazebo.html. I’m now trying to follow this guide to connect to the docker container from Simulink: https://www.mathworks.com/help/ros/ug/connect-to-a-ros-enabled-robot-from-simulink-over-ros2.html. I’m using an intel macOS with Sequoia.
The issue I’m having is that I’m not able to get the ros2 topics to show up in Matlab. They are showing correctly according to the guide inside the container, but on the matlab side they are not reflecting. I’ve set the domain ID on both sides to be 25 and to use rmw_fastrtps_cpp. On the matlab side the only topics that are being picked up are /parameter_events and /rosout.
Any insight into why Matlab is not picking up the topics that are reflecting inside the docker container would be greatly appreciated.
Thanks!Hello,
I followed this guide to set up a docker container to run gazebo: https://www.mathworks.com/help/ros/ug/install-and-set-up-docker-for-ros-2-and-gazebo.html. I’m now trying to follow this guide to connect to the docker container from Simulink: https://www.mathworks.com/help/ros/ug/connect-to-a-ros-enabled-robot-from-simulink-over-ros2.html. I’m using an intel macOS with Sequoia.
The issue I’m having is that I’m not able to get the ros2 topics to show up in Matlab. They are showing correctly according to the guide inside the container, but on the matlab side they are not reflecting. I’ve set the domain ID on both sides to be 25 and to use rmw_fastrtps_cpp. On the matlab side the only topics that are being picked up are /parameter_events and /rosout.
Any insight into why Matlab is not picking up the topics that are reflecting inside the docker container would be greatly appreciated.
Thanks! Hello,
I followed this guide to set up a docker container to run gazebo: https://www.mathworks.com/help/ros/ug/install-and-set-up-docker-for-ros-2-and-gazebo.html. I’m now trying to follow this guide to connect to the docker container from Simulink: https://www.mathworks.com/help/ros/ug/connect-to-a-ros-enabled-robot-from-simulink-over-ros2.html. I’m using an intel macOS with Sequoia.
The issue I’m having is that I’m not able to get the ros2 topics to show up in Matlab. They are showing correctly according to the guide inside the container, but on the matlab side they are not reflecting. I’ve set the domain ID on both sides to be 25 and to use rmw_fastrtps_cpp. On the matlab side the only topics that are being picked up are /parameter_events and /rosout.
Any insight into why Matlab is not picking up the topics that are reflecting inside the docker container would be greatly appreciated.
Thanks! ros2, matlab, docker MATLAB Answers — New Questions
In my laptop J just installed matlab 2020a but is showing the following issue
License checkout failed.
License Manager Error -9
Your username does not match the username in the license file.
To run on this computer, you must run the Activation client to reactivate your license.
Troubleshoot this issue by visiting:
https://www.mathworks.com/support/lme/R2020a/9
Diagnostic Information:
Feature: MATLAB
License path: /home/shishkina/.matlab/R2020a_licenses:/usr/local/MATLAB/R2020a/licenses/license.dat:/usr/local/MAT
LAB/R2020a/licenses/license_shishkina-Inspiron-5379_1096937_R2020a.lic
Licensing error: -9,57.License checkout failed.
License Manager Error -9
Your username does not match the username in the license file.
To run on this computer, you must run the Activation client to reactivate your license.
Troubleshoot this issue by visiting:
https://www.mathworks.com/support/lme/R2020a/9
Diagnostic Information:
Feature: MATLAB
License path: /home/shishkina/.matlab/R2020a_licenses:/usr/local/MATLAB/R2020a/licenses/license.dat:/usr/local/MAT
LAB/R2020a/licenses/license_shishkina-Inspiron-5379_1096937_R2020a.lic
Licensing error: -9,57. License checkout failed.
License Manager Error -9
Your username does not match the username in the license file.
To run on this computer, you must run the Activation client to reactivate your license.
Troubleshoot this issue by visiting:
https://www.mathworks.com/support/lme/R2020a/9
Diagnostic Information:
Feature: MATLAB
License path: /home/shishkina/.matlab/R2020a_licenses:/usr/local/MATLAB/R2020a/licenses/license.dat:/usr/local/MAT
LAB/R2020a/licenses/license_shishkina-Inspiron-5379_1096937_R2020a.lic
Licensing error: -9,57. matlab runnign MATLAB Answers — New Questions









