Category: Matlab
Category Archives: Matlab
how to time shift a set of data?
I have a plot of 12 cell voltages like this. There is also current here as yyaxis right, but ignore that. I forgot to remove the current, its not needed.
As you can see its unbalanced, 11 values are similar and 12th is off. The idea to solve this to time shift the 11 values to a common starting point. So make all values start from 3.6.
you can see the black lines i drew. I am trying to plot just those values. But the issue is when reduce the 11 cells starting from 3.6 then the size of those 11 values is different from the 12th value. The 12th cell size would be larger and i cant have that, because this is a 2d array and all the columns should be of same size. So i extrapolate using time of the 12th cell and time of other 11 cells, then i get value of 11 cells to have many 3.6V. The plot will be like this.
The extrapolate function i wrote is this:
11CellVoltExtrapolated = interp1(11CellsTime,11CellVolt,Timeof12thCell,’linear’, ‘extrap’);
So this is the problem. Also I cannot have nan values, because i need this array for other functions which cannot have nan values. How can i do this. Thank you.I have a plot of 12 cell voltages like this. There is also current here as yyaxis right, but ignore that. I forgot to remove the current, its not needed.
As you can see its unbalanced, 11 values are similar and 12th is off. The idea to solve this to time shift the 11 values to a common starting point. So make all values start from 3.6.
you can see the black lines i drew. I am trying to plot just those values. But the issue is when reduce the 11 cells starting from 3.6 then the size of those 11 values is different from the 12th value. The 12th cell size would be larger and i cant have that, because this is a 2d array and all the columns should be of same size. So i extrapolate using time of the 12th cell and time of other 11 cells, then i get value of 11 cells to have many 3.6V. The plot will be like this.
The extrapolate function i wrote is this:
11CellVoltExtrapolated = interp1(11CellsTime,11CellVolt,Timeof12thCell,’linear’, ‘extrap’);
So this is the problem. Also I cannot have nan values, because i need this array for other functions which cannot have nan values. How can i do this. Thank you. I have a plot of 12 cell voltages like this. There is also current here as yyaxis right, but ignore that. I forgot to remove the current, its not needed.
As you can see its unbalanced, 11 values are similar and 12th is off. The idea to solve this to time shift the 11 values to a common starting point. So make all values start from 3.6.
you can see the black lines i drew. I am trying to plot just those values. But the issue is when reduce the 11 cells starting from 3.6 then the size of those 11 values is different from the 12th value. The 12th cell size would be larger and i cant have that, because this is a 2d array and all the columns should be of same size. So i extrapolate using time of the 12th cell and time of other 11 cells, then i get value of 11 cells to have many 3.6V. The plot will be like this.
The extrapolate function i wrote is this:
11CellVoltExtrapolated = interp1(11CellsTime,11CellVolt,Timeof12thCell,’linear’, ‘extrap’);
So this is the problem. Also I cannot have nan values, because i need this array for other functions which cannot have nan values. How can i do this. Thank you. matlab MATLAB Answers — New Questions
Failed to load ‘xpclib’ library referenced by ‘block_name’
Hello,
I have an old R2011b Simulink model that I tried opening in R2025b. Upon opening the model in R2025b, I see the following:
My "CAN Setup" block in Simulink is highlighted in red and says: "xpclib" not found. The top yellow banner says: "This model contains Simulink Real-Time features that are incompatible with the current release. Open Upgrade Advisor and select "Check model for upgradable Simulink Real-Time features". Upon running the Upgrade Advisor, I get the following error:
Error occurred during model compile.
Failed to load library ‘xpclib’ referenced by ‘CAN Setup’.
Any idea on how to solve this particular problem? My understanding is that ‘xpclib’ (xPC Target) no longer exists in R2025b because it was replaced by Simulink Real-Time. I just don’t know how to convert my block to the newer library.
Thank you!Hello,
I have an old R2011b Simulink model that I tried opening in R2025b. Upon opening the model in R2025b, I see the following:
My "CAN Setup" block in Simulink is highlighted in red and says: "xpclib" not found. The top yellow banner says: "This model contains Simulink Real-Time features that are incompatible with the current release. Open Upgrade Advisor and select "Check model for upgradable Simulink Real-Time features". Upon running the Upgrade Advisor, I get the following error:
Error occurred during model compile.
Failed to load library ‘xpclib’ referenced by ‘CAN Setup’.
Any idea on how to solve this particular problem? My understanding is that ‘xpclib’ (xPC Target) no longer exists in R2025b because it was replaced by Simulink Real-Time. I just don’t know how to convert my block to the newer library.
Thank you! Hello,
I have an old R2011b Simulink model that I tried opening in R2025b. Upon opening the model in R2025b, I see the following:
My "CAN Setup" block in Simulink is highlighted in red and says: "xpclib" not found. The top yellow banner says: "This model contains Simulink Real-Time features that are incompatible with the current release. Open Upgrade Advisor and select "Check model for upgradable Simulink Real-Time features". Upon running the Upgrade Advisor, I get the following error:
Error occurred during model compile.
Failed to load library ‘xpclib’ referenced by ‘CAN Setup’.
Any idea on how to solve this particular problem? My understanding is that ‘xpclib’ (xPC Target) no longer exists in R2025b because it was replaced by Simulink Real-Time. I just don’t know how to convert my block to the newer library.
Thank you! xpc target, simulink real-time, conversion MATLAB Answers — New Questions
Desktop panels can no longer be tabbed? (2025x)
I recently made the switch from 2024b to 2025b. I have always run with the ‘Workspace’ and ‘Files’ panels tabbed together. It appears that this is no longer possible. Am I missing something? Dragging one panel over the other just swaps places. Seems like a step backwards to remove this functionality while trumpeting better ‘customization’.I recently made the switch from 2024b to 2025b. I have always run with the ‘Workspace’ and ‘Files’ panels tabbed together. It appears that this is no longer possible. Am I missing something? Dragging one panel over the other just swaps places. Seems like a step backwards to remove this functionality while trumpeting better ‘customization’. I recently made the switch from 2024b to 2025b. I have always run with the ‘Workspace’ and ‘Files’ panels tabbed together. It appears that this is no longer possible. Am I missing something? Dragging one panel over the other just swaps places. Seems like a step backwards to remove this functionality while trumpeting better ‘customization’. desktop layout, panel configuration, ui MATLAB Answers — New Questions
In what way is the new R2021b Editor UI “improved”?
I find the "new and improved" Editor UI in R2021b to be extremely irritating, in no way better than R2021a. How did this get past SQA? Following is a list of miscellaneous nuisances that I’ve run into:
The text search/replace box obscures the top text line in my file, which is a problem if the search text is obscured.
It isn’t obvious how to revert to previous search strings in the search box.
I want to rename a variable in my m-file, and before doing so I want to ensure that the new name, "num_subset", does not already exist in the file. However, there are many occurrences of the substring "num" in my file, and as soon as I start typing in the search box it jumps to the next occurrence of "num" before I’ve finished typing. So now I have to go back and find the place where I was working.
In an auto-indented code section such as a while … end block, if you insert more than one consecutive blank line in the code the auto-indenting is lost on all but one of the blank lines.
In an auto-indented block of code, if you put the cursor between two characters and press ENTER, the Editor will put in a line break with the new line indented, as expected. However, if you select (click-and-drag over) a character and press ENTER, the Editor will delete the character and replace it with a line break, as expected, but the new line will not be auto-indented.
After doing a text search you can do subsequent searches for the same text string using F3 without re-opening the search box. However, if you switch to another file (in the tabbed Editor window) F3 does not work; you have to re-open the search box. It worked in R2021a.
The search always wraps, but I usually don’t want it to wrap. There appears to be no way to disable wrapping. In R2020a the search box had an option for enabling/disabling wrapping.
The behavior of Smart Indent has changed in 2020b. In 2020a all lines in a code block would be auto-indented. In 2020b the indenting of all blank lines is removed. So if you start typing in a blank line you have to either manually put in leading tabs or re-select Smart Indent.I find the "new and improved" Editor UI in R2021b to be extremely irritating, in no way better than R2021a. How did this get past SQA? Following is a list of miscellaneous nuisances that I’ve run into:
The text search/replace box obscures the top text line in my file, which is a problem if the search text is obscured.
It isn’t obvious how to revert to previous search strings in the search box.
I want to rename a variable in my m-file, and before doing so I want to ensure that the new name, "num_subset", does not already exist in the file. However, there are many occurrences of the substring "num" in my file, and as soon as I start typing in the search box it jumps to the next occurrence of "num" before I’ve finished typing. So now I have to go back and find the place where I was working.
In an auto-indented code section such as a while … end block, if you insert more than one consecutive blank line in the code the auto-indenting is lost on all but one of the blank lines.
In an auto-indented block of code, if you put the cursor between two characters and press ENTER, the Editor will put in a line break with the new line indented, as expected. However, if you select (click-and-drag over) a character and press ENTER, the Editor will delete the character and replace it with a line break, as expected, but the new line will not be auto-indented.
After doing a text search you can do subsequent searches for the same text string using F3 without re-opening the search box. However, if you switch to another file (in the tabbed Editor window) F3 does not work; you have to re-open the search box. It worked in R2021a.
The search always wraps, but I usually don’t want it to wrap. There appears to be no way to disable wrapping. In R2020a the search box had an option for enabling/disabling wrapping.
The behavior of Smart Indent has changed in 2020b. In 2020a all lines in a code block would be auto-indented. In 2020b the indenting of all blank lines is removed. So if you start typing in a blank line you have to either manually put in leading tabs or re-select Smart Indent. I find the "new and improved" Editor UI in R2021b to be extremely irritating, in no way better than R2021a. How did this get past SQA? Following is a list of miscellaneous nuisances that I’ve run into:
The text search/replace box obscures the top text line in my file, which is a problem if the search text is obscured.
It isn’t obvious how to revert to previous search strings in the search box.
I want to rename a variable in my m-file, and before doing so I want to ensure that the new name, "num_subset", does not already exist in the file. However, there are many occurrences of the substring "num" in my file, and as soon as I start typing in the search box it jumps to the next occurrence of "num" before I’ve finished typing. So now I have to go back and find the place where I was working.
In an auto-indented code section such as a while … end block, if you insert more than one consecutive blank line in the code the auto-indenting is lost on all but one of the blank lines.
In an auto-indented block of code, if you put the cursor between two characters and press ENTER, the Editor will put in a line break with the new line indented, as expected. However, if you select (click-and-drag over) a character and press ENTER, the Editor will delete the character and replace it with a line break, as expected, but the new line will not be auto-indented.
After doing a text search you can do subsequent searches for the same text string using F3 without re-opening the search box. However, if you switch to another file (in the tabbed Editor window) F3 does not work; you have to re-open the search box. It worked in R2021a.
The search always wraps, but I usually don’t want it to wrap. There appears to be no way to disable wrapping. In R2020a the search box had an option for enabling/disabling wrapping.
The behavior of Smart Indent has changed in 2020b. In 2020a all lines in a code block would be auto-indented. In 2020b the indenting of all blank lines is removed. So if you start typing in a blank line you have to either manually put in leading tabs or re-select Smart Indent. r2021b, editor MATLAB Answers — New Questions
Where is the algebraic loop coming from?
Dear all,
I faced an issue with algebraic loop in simulink (see the model attached).
When I update the model it says "Algebraic loop error", even though there seem to be no algebraic loop at all.
The issue is resolved if I combine these two subsystems into a one.
Could you please explain where the algebraic loop is coming from?
Thank you!Dear all,
I faced an issue with algebraic loop in simulink (see the model attached).
When I update the model it says "Algebraic loop error", even though there seem to be no algebraic loop at all.
The issue is resolved if I combine these two subsystems into a one.
Could you please explain where the algebraic loop is coming from?
Thank you! Dear all,
I faced an issue with algebraic loop in simulink (see the model attached).
When I update the model it says "Algebraic loop error", even though there seem to be no algebraic loop at all.
The issue is resolved if I combine these two subsystems into a one.
Could you please explain where the algebraic loop is coming from?
Thank you! algebraic loop, simulink, model update MATLAB Answers — New Questions
How could i implement a specific torque-rpm engine characteristics?
For my diploma work, i decided to realistically implement a truck driveline, and that includes engine characteristics as well. My first general idea was using the generic engine block, but using tabulated torque data gives me no response, constant 0 torque output. Any help, or better ideas would be much appreciated. I suspect some kind of error in me setting the block itself up, something with the rpms, thresholds? I’ve tried countless variations, but nothing seemed to work.
Thank you all in forward.
CheersFor my diploma work, i decided to realistically implement a truck driveline, and that includes engine characteristics as well. My first general idea was using the generic engine block, but using tabulated torque data gives me no response, constant 0 torque output. Any help, or better ideas would be much appreciated. I suspect some kind of error in me setting the block itself up, something with the rpms, thresholds? I’ve tried countless variations, but nothing seemed to work.
Thank you all in forward.
Cheers For my diploma work, i decided to realistically implement a truck driveline, and that includes engine characteristics as well. My first general idea was using the generic engine block, but using tabulated torque data gives me no response, constant 0 torque output. Any help, or better ideas would be much appreciated. I suspect some kind of error in me setting the block itself up, something with the rpms, thresholds? I’ve tried countless variations, but nothing seemed to work.
Thank you all in forward.
Cheers simscape, driveline, generic engine, piston engine, semi truck engine MATLAB Answers — New Questions
Why contourf connect far apart points
I have a problem with the contour it connects far apart points and appear colored lines ( I already set ‘LineStyle’, ‘none’) that they shouldn’t how can I avoid this problem? My data are in a cell arrays and I use cell2mat to create matrices and then I do the contour If I do it from the cell arrays I don’t have this problem but is too slow and use all the memory so I don’t like this approach.I have a problem with the contour it connects far apart points and appear colored lines ( I already set ‘LineStyle’, ‘none’) that they shouldn’t how can I avoid this problem? My data are in a cell arrays and I use cell2mat to create matrices and then I do the contour If I do it from the cell arrays I don’t have this problem but is too slow and use all the memory so I don’t like this approach. I have a problem with the contour it connects far apart points and appear colored lines ( I already set ‘LineStyle’, ‘none’) that they shouldn’t how can I avoid this problem? My data are in a cell arrays and I use cell2mat to create matrices and then I do the contour If I do it from the cell arrays I don’t have this problem but is too slow and use all the memory so I don’t like this approach. contourf, far appart points MATLAB Answers — New Questions
How to dock/undock an image using matlab code instead of doing manually?
How to dock/undock an image using matlab code instead of doing manually?…can any one helpHow to dock/undock an image using matlab code instead of doing manually?…can any one help How to dock/undock an image using matlab code instead of doing manually?…can any one help image processing, image, image analysis, image acquisition MATLAB Answers — New Questions
Warning: An error occurred while drawing the scene: Error in json_scenetree: Could not find node in replaceChild
My matlab version is 2020(a).
It always calls the "Warning: An error occurred while drawing the scene: Error in json_scenetree: Could not find node in replaceChild" .
I had try the previous solution "opengl software" , but it didn’t work.
This is the code I complie.
Is the code have problem or matlab problem.
How can I deal with this problem?
clear all
close all
clc
ATT = 1;
DATE = datestr(now, 30);
mdl = ‘quarter_car’;
open_system(mdl)
agentblk = [mdl ‘/RL Agent’];
numObs = 5;
numAct = 2;
observationInfo = rlNumericSpec([numObs 1],’LowerLimit’,-inf*ones(numObs,1),’UpperLimit’,inf*ones(numObs,1));
observationInfo.Name = ‘observation’;
actionInfo = rlFiniteSetSpec({[0;0],[0;1]});
actionInfo.Name = ‘actor’;
env = rlSimulinkEnv(mdl,agentblk,observationInfo,actionInfo);
Ts = 0.01;
Tf = 10;
rng(0)
statePath = [
imageInputLayer([numObs 1 1],’Normalization’,’none’,’Name’,’observation’)
fullyConnectedLayer(50,’Name’,’CriticObsFC1′)
reluLayer(‘Name’,’CriticRelu1′)
fullyConnectedLayer(30,’Name’,’CriticObsFC2′)];
actionPath = [
imageInputLayer([numAct 1 1],’Normalization’,’none’,’Name’,’action’)
fullyConnectedLayer(30,’Name’,’CriticActFC1′)];
commonPath = [
additionLayer(2,’Name’,’add’)
reluLayer(‘Name’,’CriticCommonRelu’)
fullyConnectedLayer(1,’Name’,’output’)];
criticNetwork = layerGraph(statePath);
criticNetwork = addLayers(criticNetwork,actionPath);
criticNetwork = addLayers(criticNetwork,commonPath);
criticNetwork = connectLayers(criticNetwork,’CriticObsFC2′,’add/in1′);
criticNetwork = connectLayers(criticNetwork,’CriticActFC1′,’add/in2′);
criticOpts = rlRepresentationOptions(‘LearnRate’,0.001,’GradientThreshold’,1);
obsInfo = getObservationInfo(env);
actInfo = getActionInfo(env);
critic = rlQValueRepresentation(criticNetwork,obsInfo,actInfo,’Observation’,{‘observation’},’Action’,{‘action’},criticOpts);
agentOptions = rlDQNAgentOptions(…
‘SampleTime’,Ts,…
‘TargetSmoothFactor’,1e-3,…
‘ExperienceBufferLength’,1e6,…
‘UseDoubleDQN’,false,…
‘DiscountFactor’,0.5,…
‘MiniBatchSize’,64);
agentOpts.NoiseOptions.Variance = 0.5;
agentOpts.NoiseOptions.VarianceDecayRate = 1e-3;
agent = rlDQNAgent(critic,agentOptions);
maxepisodes = 2000;
maxsteps = ceil(Tf/Ts);
trainingOptions = rlTrainingOptions(…
‘MaxEpisodes’,maxepisodes,…
‘MaxStepsPerEpisode’,maxsteps,…
‘ScoreAveragingWindowLength’,5,…
‘Verbose’,false,…
‘Plots’,’training-progress’,…
‘StopTrainingCriteria’,’AverageReward’,…
‘StopTrainingValue’, 25000);
trainingStats = train(agent,env,trainingOptions);
simOptions = rlSimulationOptions(‘MaxSteps’, maxsteps);
experience = sim(env,agent,simOptions);My matlab version is 2020(a).
It always calls the "Warning: An error occurred while drawing the scene: Error in json_scenetree: Could not find node in replaceChild" .
I had try the previous solution "opengl software" , but it didn’t work.
This is the code I complie.
Is the code have problem or matlab problem.
How can I deal with this problem?
clear all
close all
clc
ATT = 1;
DATE = datestr(now, 30);
mdl = ‘quarter_car’;
open_system(mdl)
agentblk = [mdl ‘/RL Agent’];
numObs = 5;
numAct = 2;
observationInfo = rlNumericSpec([numObs 1],’LowerLimit’,-inf*ones(numObs,1),’UpperLimit’,inf*ones(numObs,1));
observationInfo.Name = ‘observation’;
actionInfo = rlFiniteSetSpec({[0;0],[0;1]});
actionInfo.Name = ‘actor’;
env = rlSimulinkEnv(mdl,agentblk,observationInfo,actionInfo);
Ts = 0.01;
Tf = 10;
rng(0)
statePath = [
imageInputLayer([numObs 1 1],’Normalization’,’none’,’Name’,’observation’)
fullyConnectedLayer(50,’Name’,’CriticObsFC1′)
reluLayer(‘Name’,’CriticRelu1′)
fullyConnectedLayer(30,’Name’,’CriticObsFC2′)];
actionPath = [
imageInputLayer([numAct 1 1],’Normalization’,’none’,’Name’,’action’)
fullyConnectedLayer(30,’Name’,’CriticActFC1′)];
commonPath = [
additionLayer(2,’Name’,’add’)
reluLayer(‘Name’,’CriticCommonRelu’)
fullyConnectedLayer(1,’Name’,’output’)];
criticNetwork = layerGraph(statePath);
criticNetwork = addLayers(criticNetwork,actionPath);
criticNetwork = addLayers(criticNetwork,commonPath);
criticNetwork = connectLayers(criticNetwork,’CriticObsFC2′,’add/in1′);
criticNetwork = connectLayers(criticNetwork,’CriticActFC1′,’add/in2′);
criticOpts = rlRepresentationOptions(‘LearnRate’,0.001,’GradientThreshold’,1);
obsInfo = getObservationInfo(env);
actInfo = getActionInfo(env);
critic = rlQValueRepresentation(criticNetwork,obsInfo,actInfo,’Observation’,{‘observation’},’Action’,{‘action’},criticOpts);
agentOptions = rlDQNAgentOptions(…
‘SampleTime’,Ts,…
‘TargetSmoothFactor’,1e-3,…
‘ExperienceBufferLength’,1e6,…
‘UseDoubleDQN’,false,…
‘DiscountFactor’,0.5,…
‘MiniBatchSize’,64);
agentOpts.NoiseOptions.Variance = 0.5;
agentOpts.NoiseOptions.VarianceDecayRate = 1e-3;
agent = rlDQNAgent(critic,agentOptions);
maxepisodes = 2000;
maxsteps = ceil(Tf/Ts);
trainingOptions = rlTrainingOptions(…
‘MaxEpisodes’,maxepisodes,…
‘MaxStepsPerEpisode’,maxsteps,…
‘ScoreAveragingWindowLength’,5,…
‘Verbose’,false,…
‘Plots’,’training-progress’,…
‘StopTrainingCriteria’,’AverageReward’,…
‘StopTrainingValue’, 25000);
trainingStats = train(agent,env,trainingOptions);
simOptions = rlSimulationOptions(‘MaxSteps’, maxsteps);
experience = sim(env,agent,simOptions); My matlab version is 2020(a).
It always calls the "Warning: An error occurred while drawing the scene: Error in json_scenetree: Could not find node in replaceChild" .
I had try the previous solution "opengl software" , but it didn’t work.
This is the code I complie.
Is the code have problem or matlab problem.
How can I deal with this problem?
clear all
close all
clc
ATT = 1;
DATE = datestr(now, 30);
mdl = ‘quarter_car’;
open_system(mdl)
agentblk = [mdl ‘/RL Agent’];
numObs = 5;
numAct = 2;
observationInfo = rlNumericSpec([numObs 1],’LowerLimit’,-inf*ones(numObs,1),’UpperLimit’,inf*ones(numObs,1));
observationInfo.Name = ‘observation’;
actionInfo = rlFiniteSetSpec({[0;0],[0;1]});
actionInfo.Name = ‘actor’;
env = rlSimulinkEnv(mdl,agentblk,observationInfo,actionInfo);
Ts = 0.01;
Tf = 10;
rng(0)
statePath = [
imageInputLayer([numObs 1 1],’Normalization’,’none’,’Name’,’observation’)
fullyConnectedLayer(50,’Name’,’CriticObsFC1′)
reluLayer(‘Name’,’CriticRelu1′)
fullyConnectedLayer(30,’Name’,’CriticObsFC2′)];
actionPath = [
imageInputLayer([numAct 1 1],’Normalization’,’none’,’Name’,’action’)
fullyConnectedLayer(30,’Name’,’CriticActFC1′)];
commonPath = [
additionLayer(2,’Name’,’add’)
reluLayer(‘Name’,’CriticCommonRelu’)
fullyConnectedLayer(1,’Name’,’output’)];
criticNetwork = layerGraph(statePath);
criticNetwork = addLayers(criticNetwork,actionPath);
criticNetwork = addLayers(criticNetwork,commonPath);
criticNetwork = connectLayers(criticNetwork,’CriticObsFC2′,’add/in1′);
criticNetwork = connectLayers(criticNetwork,’CriticActFC1′,’add/in2′);
criticOpts = rlRepresentationOptions(‘LearnRate’,0.001,’GradientThreshold’,1);
obsInfo = getObservationInfo(env);
actInfo = getActionInfo(env);
critic = rlQValueRepresentation(criticNetwork,obsInfo,actInfo,’Observation’,{‘observation’},’Action’,{‘action’},criticOpts);
agentOptions = rlDQNAgentOptions(…
‘SampleTime’,Ts,…
‘TargetSmoothFactor’,1e-3,…
‘ExperienceBufferLength’,1e6,…
‘UseDoubleDQN’,false,…
‘DiscountFactor’,0.5,…
‘MiniBatchSize’,64);
agentOpts.NoiseOptions.Variance = 0.5;
agentOpts.NoiseOptions.VarianceDecayRate = 1e-3;
agent = rlDQNAgent(critic,agentOptions);
maxepisodes = 2000;
maxsteps = ceil(Tf/Ts);
trainingOptions = rlTrainingOptions(…
‘MaxEpisodes’,maxepisodes,…
‘MaxStepsPerEpisode’,maxsteps,…
‘ScoreAveragingWindowLength’,5,…
‘Verbose’,false,…
‘Plots’,’training-progress’,…
‘StopTrainingCriteria’,’AverageReward’,…
‘StopTrainingValue’, 25000);
trainingStats = train(agent,env,trainingOptions);
simOptions = rlSimulationOptions(‘MaxSteps’, maxsteps);
experience = sim(env,agent,simOptions); matlab warning reinforcement learning MATLAB Answers — New Questions
why does set(gca) not working
I am trying to set the axis label’s font size. Here is my code
%% This section of code plots the k-means cost as a function of the number
% of iterations
% Count the number of iterations.
figure;
x = 1:max_iter; % this is the x axis
grid on;
set(gca,’fontsize’,FONT_SIZE) % THIS IS WHEN I TRIED TO USE GCA BUT IT DOES NOT WORK
plot(x,cost_iteration,’bo-‘); % plot the cost per iteration
title("Graph of K-means Cost Per Iteration", ‘Fontsize’,FONT_SIZE);
xlabel("iteration", ‘Fontsize’,FONT_SIZE);
ylabel("cost", ‘Fontsize’,FONT_SIZE);
axis normal;
I tried to use set to make the font size of gca work, but it does not work. and here is what I print out.
please helpI am trying to set the axis label’s font size. Here is my code
%% This section of code plots the k-means cost as a function of the number
% of iterations
% Count the number of iterations.
figure;
x = 1:max_iter; % this is the x axis
grid on;
set(gca,’fontsize’,FONT_SIZE) % THIS IS WHEN I TRIED TO USE GCA BUT IT DOES NOT WORK
plot(x,cost_iteration,’bo-‘); % plot the cost per iteration
title("Graph of K-means Cost Per Iteration", ‘Fontsize’,FONT_SIZE);
xlabel("iteration", ‘Fontsize’,FONT_SIZE);
ylabel("cost", ‘Fontsize’,FONT_SIZE);
axis normal;
I tried to use set to make the font size of gca work, but it does not work. and here is what I print out.
please help I am trying to set the axis label’s font size. Here is my code
%% This section of code plots the k-means cost as a function of the number
% of iterations
% Count the number of iterations.
figure;
x = 1:max_iter; % this is the x axis
grid on;
set(gca,’fontsize’,FONT_SIZE) % THIS IS WHEN I TRIED TO USE GCA BUT IT DOES NOT WORK
plot(x,cost_iteration,’bo-‘); % plot the cost per iteration
title("Graph of K-means Cost Per Iteration", ‘Fontsize’,FONT_SIZE);
xlabel("iteration", ‘Fontsize’,FONT_SIZE);
ylabel("cost", ‘Fontsize’,FONT_SIZE);
axis normal;
I tried to use set to make the font size of gca work, but it does not work. and here is what I print out.
please help set, plot MATLAB Answers — New Questions
Why do i get a figure window that is completely blank
Post Content Post Content plot table MATLAB Answers — New Questions
How can I interface MATLAB with Azure Digital Twins (DTDL models) to exchange telemetry and parameters for dynamic simulation and control
I am working on a project where I want to use MATLAB/Simulink to simulate the dynamic behavior of a physical process (e.g., a heat exchanger) and run a feedback control loop.
Since DTDL models in Azure Digital Twins (ADT) cannot perform calculations, I want MATLAB to:
Read parameters from the digital twin (e.g., temperature from a transmitter twin, setpoint from an operator twin).
Run the control simulation in MATLAB/Simulink (e.g., PID control to calculate valve position and outlet temperature).
Write telemetry updates back to the Azure Digital Twin in JSON format so the twin always reflects the updated system behavior.
I would like to know:
What is the best way to connect MATLAB with Azure ADT?
Can I use webread and webwrite in MATLAB to call ADT REST APIs for reading/writing telemetry?
Are there any example codes or workflows that show how to structure this interface?
How do I authenticate MATLAB with Azure (e.g., using tokens for the ADT REST API)?I am working on a project where I want to use MATLAB/Simulink to simulate the dynamic behavior of a physical process (e.g., a heat exchanger) and run a feedback control loop.
Since DTDL models in Azure Digital Twins (ADT) cannot perform calculations, I want MATLAB to:
Read parameters from the digital twin (e.g., temperature from a transmitter twin, setpoint from an operator twin).
Run the control simulation in MATLAB/Simulink (e.g., PID control to calculate valve position and outlet temperature).
Write telemetry updates back to the Azure Digital Twin in JSON format so the twin always reflects the updated system behavior.
I would like to know:
What is the best way to connect MATLAB with Azure ADT?
Can I use webread and webwrite in MATLAB to call ADT REST APIs for reading/writing telemetry?
Are there any example codes or workflows that show how to structure this interface?
How do I authenticate MATLAB with Azure (e.g., using tokens for the ADT REST API)? I am working on a project where I want to use MATLAB/Simulink to simulate the dynamic behavior of a physical process (e.g., a heat exchanger) and run a feedback control loop.
Since DTDL models in Azure Digital Twins (ADT) cannot perform calculations, I want MATLAB to:
Read parameters from the digital twin (e.g., temperature from a transmitter twin, setpoint from an operator twin).
Run the control simulation in MATLAB/Simulink (e.g., PID control to calculate valve position and outlet temperature).
Write telemetry updates back to the Azure Digital Twin in JSON format so the twin always reflects the updated system behavior.
I would like to know:
What is the best way to connect MATLAB with Azure ADT?
Can I use webread and webwrite in MATLAB to call ADT REST APIs for reading/writing telemetry?
Are there any example codes or workflows that show how to structure this interface?
How do I authenticate MATLAB with Azure (e.g., using tokens for the ADT REST API)? control, digital twin MATLAB Answers — New Questions
How to compare two measurement datas from 2 different devices?
Hallo,
I have two different csv measurements(xyz) from 2 different devices. One is a device doing spiral scanning and other is an interferometer. Since both of the devices will give different xyz. I am scanning the same workpiece in both devices. In order to do better comparison, i believe i need xyz almost close to each other for the devices,so how can i do it? Is the interpolation over common grid (x,y) works or is there any other better options?Hallo,
I have two different csv measurements(xyz) from 2 different devices. One is a device doing spiral scanning and other is an interferometer. Since both of the devices will give different xyz. I am scanning the same workpiece in both devices. In order to do better comparison, i believe i need xyz almost close to each other for the devices,so how can i do it? Is the interpolation over common grid (x,y) works or is there any other better options? Hallo,
I have two different csv measurements(xyz) from 2 different devices. One is a device doing spiral scanning and other is an interferometer. Since both of the devices will give different xyz. I am scanning the same workpiece in both devices. In order to do better comparison, i believe i need xyz almost close to each other for the devices,so how can i do it? Is the interpolation over common grid (x,y) works or is there any other better options? interpolation, averaging MATLAB Answers — New Questions
How do I prevent motor from entering reverse generating region, and stay in forward motoring region?
I am trying to simulate an electric motor for an aircraft, but when I input my reference speed and torque demand, the motor seems to enter reverse generating instead of forward motoring.
The motor parameters are as such:
The motor’s torque output vs torque demand as shown:
However, the motor’s rpm output vs reference rpm is as shown:
Is there a way to "force" the motor to stay in quadrant 1 as opposed to entering quadrant 4?I am trying to simulate an electric motor for an aircraft, but when I input my reference speed and torque demand, the motor seems to enter reverse generating instead of forward motoring.
The motor parameters are as such:
The motor’s torque output vs torque demand as shown:
However, the motor’s rpm output vs reference rpm is as shown:
Is there a way to "force" the motor to stay in quadrant 1 as opposed to entering quadrant 4? I am trying to simulate an electric motor for an aircraft, but when I input my reference speed and torque demand, the motor seems to enter reverse generating instead of forward motoring.
The motor parameters are as such:
The motor’s torque output vs torque demand as shown:
However, the motor’s rpm output vs reference rpm is as shown:
Is there a way to "force" the motor to stay in quadrant 1 as opposed to entering quadrant 4? simulink, simscape MATLAB Answers — New Questions
Por favor el pzmap código
-que símbolos y nomencaltura usa-que símbolos y nomencaltura usa -que símbolos y nomencaltura usa diagrama pz MATLAB Answers — New Questions
Issue Related to Interfacing simulink with arduino hardware
Hi. This is the error I am getting. I had installed the simulink for arduino add on for hardware support
And also sort for the COM port issue as mentioned in your web site
### Starting build procedure for: Lab_1_2 "### Generating static library." "F:/waqas/bin/win64/gmake" -j5 -C "C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1" SHELL="%SystemRoot%/system32/cmd.exe" -f avrcore.mk all gmake[1]: Entering directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "### Successfully generated libcore.a library." gmake[1]: Leaving directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "F:/waqas/bin/win64/gmake" -j5 SHELL="%SystemRoot%/system32/cmd.exe" -f "Lab_1_2.mk" all gmake[1]: Entering directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-g++" -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"MW_arduino_digitalio.dep" -MT"MW_arduino_digitalio.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include –
IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "MW_arduino_digitalio.o" "C:/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/target/supportpackages/arduinobase/src/MW_arduino_digitalio.cpp" "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-gcc" -std=gnu11 -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"xcp_ext_mode.dep" -MT"xcp_ext_mode.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGavr-g++: error: Box/Lab: No such file or directory ER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "xcp_ext_mode.o" "F:/waqas/toolbox/coder/xcp/src/target/ext_mode/src/xcp_ext_mode.c" avr-g++: error: 1.2: No such file or directory avr-g++: error: Box/Lab: No such file or directory avr-g++: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** No rule to make target F:/ACE’, needed by Lab_1_2.o’. Stop. gmake[1]: *** Waiting for unfinished jobs…. gmake[1]: *** [MW_arduino_digitalio.o] Error 1 avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2: No such file or directory avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** [xcp_ext_mode.o] Error 1 gmake[1]: Leaving directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ gmake: *** [all] Error 2 The make command returned an error of 2 ### Build procedure for Lab_1_2 aborted due to an error. Build Summary Top model targets built: Model Action Rebuild Reason =================================================================== Lab_1_2 Failed Code generation information file does not exist. 0 of 1 models built (0 models already up to date) Build duration: 0h 2m 8.7477sHi. This is the error I am getting. I had installed the simulink for arduino add on for hardware support
And also sort for the COM port issue as mentioned in your web site
### Starting build procedure for: Lab_1_2 "### Generating static library." "F:/waqas/bin/win64/gmake" -j5 -C "C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1" SHELL="%SystemRoot%/system32/cmd.exe" -f avrcore.mk all gmake[1]: Entering directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "### Successfully generated libcore.a library." gmake[1]: Leaving directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "F:/waqas/bin/win64/gmake" -j5 SHELL="%SystemRoot%/system32/cmd.exe" -f "Lab_1_2.mk" all gmake[1]: Entering directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-g++" -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"MW_arduino_digitalio.dep" -MT"MW_arduino_digitalio.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include –
IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "MW_arduino_digitalio.o" "C:/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/target/supportpackages/arduinobase/src/MW_arduino_digitalio.cpp" "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-gcc" -std=gnu11 -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"xcp_ext_mode.dep" -MT"xcp_ext_mode.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGavr-g++: error: Box/Lab: No such file or directory ER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "xcp_ext_mode.o" "F:/waqas/toolbox/coder/xcp/src/target/ext_mode/src/xcp_ext_mode.c" avr-g++: error: 1.2: No such file or directory avr-g++: error: Box/Lab: No such file or directory avr-g++: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** No rule to make target F:/ACE’, needed by Lab_1_2.o’. Stop. gmake[1]: *** Waiting for unfinished jobs…. gmake[1]: *** [MW_arduino_digitalio.o] Error 1 avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2: No such file or directory avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** [xcp_ext_mode.o] Error 1 gmake[1]: Leaving directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ gmake: *** [all] Error 2 The make command returned an error of 2 ### Build procedure for Lab_1_2 aborted due to an error. Build Summary Top model targets built: Model Action Rebuild Reason =================================================================== Lab_1_2 Failed Code generation information file does not exist. 0 of 1 models built (0 models already up to date) Build duration: 0h 2m 8.7477s Hi. This is the error I am getting. I had installed the simulink for arduino add on for hardware support
And also sort for the COM port issue as mentioned in your web site
### Starting build procedure for: Lab_1_2 "### Generating static library." "F:/waqas/bin/win64/gmake" -j5 -C "C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1" SHELL="%SystemRoot%/system32/cmd.exe" -f avrcore.mk all gmake[1]: Entering directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "### Successfully generated libcore.a library." gmake[1]: Leaving directory C:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/STATIC~1′ "F:/waqas/bin/win64/gmake" -j5 SHELL="%SystemRoot%/system32/cmd.exe" -f "Lab_1_2.mk" all gmake[1]: Entering directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-g++" -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"MW_arduino_digitalio.dep" -MT"MW_arduino_digitalio.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include –
IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "MW_arduino_digitalio.o" "C:/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/target/supportpackages/arduinobase/src/MW_arduino_digitalio.cpp" "C:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/bin/avr-gcc" -std=gnu11 -c -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10801 -MMD -MP -MF"xcp_ext_mode.dep" -MT"xcp_ext_mode.o" -Os -g -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DXCP_ADDRESS_GRANULARITY=XCP_ADDRESS_GRANULARITY_BYTE -DCODERTARGET_XCP_DAQ_PACKED_MODE -DCODERTARGET_XCP_MAX_CONTIGUOUS_SAMPLES=2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_TIMERID=1 -DMW_PRESCALAR=256 -DMW_TIMERCOUNT=59286 -DMW_SCHEDULERCOUNTER=1 -DARDUINO_NUM_SERIAL_PORTS=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_CONFIG_SERIAL0_=SERIAL_8N1 -D_RTT_ANALOG_REF_=0 -DMW_RTIO_SERIAL0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DEXT_MODE=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DXCP_EXTMODE_SIMULATION_TIME_IN_TICKS -DXCP_DAQ_SUPPORT -DXCP_CALIBRATION_SUPPORT -DXCP_TIMESTAMP_SUPPORT -DXCP_TIMESTAMP_BASED_ON_SIMULATION_TIME -DXCP_SET_MTA_SUPPORT -DEXTMODE_XCP_TRIGGavr-g++: error: Box/Lab: No such file or directory ER_SUPPORT -DXCP_MEM_BLOCK_1_SIZE=32 -DXCP_MEM_BLOCK_1_NUMBER=1 -DXCP_MEM_BLOCK_2_SIZE=56 -DXCP_MEM_BLOCK_2_NUMBER=1 -DXCP_MEM_BLOCK_3_SIZE=8 -DXCP_MEM_BLOCK_3_NUMBER=1 -DXCP_MEM_RESERVED_POOLS_TOTAL_SIZE=212 -DXCP_MEM_RESERVED_POOLS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOL_BLOCKS_NUMBER=2 -DXCP_MEM_DAQ_RESERVED_POOLS_NUMBER=1 -DXCP_MIN_EVENT_NO_RESERVED_POOL=1 -DXCP_MAX_CTO_SIZE=32 -DXCP_MAX_DTO_SIZE=65532 -DXCP_MAX_ODT_ENTRY_SIZE=255 -DEXTMODE_STATIC -DEXTMODE_STATIC_SIZE=250 -DON_TARGET_WAIT_FOR_START=1 -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=Lab_1_2 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -IF:/ACE Box/Lab 1.2 -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~2/include -IF:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw -IF:/waqas/extern/include -IF:/waqas/simulink/include -IF:/waqas/rtw/c/src -IF:/waqas/rtw/c/src/ext_mode/common -IF:/waqas/rtw/c/ert -IF:/waqas/toolbox/coder/xcp/src/target/server/include -IF:/waqas/toolbox/coder/xcp/src/target/server/common -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/src -IF:/waqas/toolbox/coder/xcp/src/target/server/protocol/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/include -IF:/waqas/toolbox/coder/xcp/src/target/server/transport/src -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/include -IF:/waqas/toolbox/coder/xcp/src/target/server/platform/default -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/include -IF:/waqas/toolbox/coder/xcp/src/target/ext_mode/src -IF:/waqas/toolbox/coder/rtiostream/src -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/libraries/Servo/src -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/include -IC:/PROGRA~3/MATLAB/SUPPOR~1/R2023b/toolbox/target/SUPPOR~1/ARDUIN~1/SCHEDU~1/include -IC:/ProgramData/MATLAB/SupportPackages/R2023b/aIDE/hardware/tools/avr/avr/include/avr -o "xcp_ext_mode.o" "F:/waqas/toolbox/coder/xcp/src/target/ext_mode/src/xcp_ext_mode.c" avr-g++: error: 1.2: No such file or directory avr-g++: error: Box/Lab: No such file or directory avr-g++: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** No rule to make target F:/ACE’, needed by Lab_1_2.o’. Stop. gmake[1]: *** Waiting for unfinished jobs…. gmake[1]: *** [MW_arduino_digitalio.o] Error 1 avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2: No such file or directory avr-gcc: error: Box/Lab: No such file or directory avr-gcc: error: 1.2/Lab_1_2_ert_rtw: No such file or directory gmake[1]: *** [xcp_ext_mode.o] Error 1 gmake[1]: Leaving directory F:/ACE Box/Lab 1.2/Lab_1_2_ert_rtw’ gmake: *** [all] Error 2 The make command returned an error of 2 ### Build procedure for Lab_1_2 aborted due to an error. Build Summary Top model targets built: Model Action Rebuild Reason =================================================================== Lab_1_2 Failed Code generation information file does not exist. 0 of 1 models built (0 models already up to date) Build duration: 0h 2m 8.7477s arduino MATLAB Answers — New Questions
importing a table from a file with multiple tables
I want to specifically import data from Table 3 but I’m unsure how to write that in my script.
If anyone could help I’d appreciate it:)I want to specifically import data from Table 3 but I’m unsure how to write that in my script.
If anyone could help I’d appreciate it:) I want to specifically import data from Table 3 but I’m unsure how to write that in my script.
If anyone could help I’d appreciate it:) tables, importing excel data MATLAB Answers — New Questions
Error using countOnes = sum(num); when trying to count how many zeros and ones are randomly generated.
I have never used MATLAB before, and am trying to randomly generate 0s and 1s to calculate the probability of getting heads or tails on a coin. I used the code below, but keep getting an error on the line showing countOnes = sum(num); saying ‘array indices must be positive integers or logical values.’. Anyone know what might be wrong? I clicked the explain error and it wasn’t clear.
rng(‘shuffle’); %Generates a random number each time, instead of the same sequence
N = 1000; %Sets value of N to 1000 to simulate 1000 flips of the coin
num = randi([0,1], N, 1); %Generates a number 0 or 1
countOnes = sum(num);
countZeros = N – countOnes;
disp([‘Number of 1s: ‘, num2str(countOnes)]);
disp([‘Number of 0s: ‘, num2str(countZeros)]);I have never used MATLAB before, and am trying to randomly generate 0s and 1s to calculate the probability of getting heads or tails on a coin. I used the code below, but keep getting an error on the line showing countOnes = sum(num); saying ‘array indices must be positive integers or logical values.’. Anyone know what might be wrong? I clicked the explain error and it wasn’t clear.
rng(‘shuffle’); %Generates a random number each time, instead of the same sequence
N = 1000; %Sets value of N to 1000 to simulate 1000 flips of the coin
num = randi([0,1], N, 1); %Generates a number 0 or 1
countOnes = sum(num);
countZeros = N – countOnes;
disp([‘Number of 1s: ‘, num2str(countOnes)]);
disp([‘Number of 0s: ‘, num2str(countZeros)]); I have never used MATLAB before, and am trying to randomly generate 0s and 1s to calculate the probability of getting heads or tails on a coin. I used the code below, but keep getting an error on the line showing countOnes = sum(num); saying ‘array indices must be positive integers or logical values.’. Anyone know what might be wrong? I clicked the explain error and it wasn’t clear.
rng(‘shuffle’); %Generates a random number each time, instead of the same sequence
N = 1000; %Sets value of N to 1000 to simulate 1000 flips of the coin
num = randi([0,1], N, 1); %Generates a number 0 or 1
countOnes = sum(num);
countZeros = N – countOnes;
disp([‘Number of 1s: ‘, num2str(countOnes)]);
disp([‘Number of 0s: ‘, num2str(countZeros)]); random number generator, probability MATLAB Answers — New Questions
ode23 clarity and examples
clc; clearvars; close all; format short g; format compact;
global Qss Q Qjss Qj V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
% Q in m^3/s, V in m^3, T in oC, cp in J/kg K, rho in kg/m^3
% Physical properties
rho = 1000; rhoj = 1000; cp = 1269; cpj = 1269; UA = 1796; % J/K s
% Geometric parameters
V = 0.2832; Vj = 0.02832;
% Steady state process parameters
Qss = 4.719e-4; Qjss = 7.078e-4; Tinss = 10; Tjinss = 93.33;
% Actual process parameters
Q = 4.719e-4; Qj = 7.078e-4; Tin = 10; Tjin = 93.33;
% Tss = 51.67; Tjss = 65.56; % in oC (steady-state values from book)
% Linear stability analysis
A11 = -(Qss/V)-(UA/(rho*V*cp));
A12 = (UA/(rho*V*cp));
A21 = (UA/(rhoj*Vj*cpj));
A22 = -(Qjss/Vj)-(UA/(rhoj*Vj*cpj));
A = [A11 A12; A21 A22];
[ev, eval] = eig(A);
exitTs = fsolve(@tankheaterss,[10 101]);
Tss = exitTs(1); Tjss = exitTs(2);
tfinal = 2000;
T0 = Tss; Tj0 = Tjss;
% Slow response – perturbation in slow direction
% T0 = Tss + 5*ev(1,1); Tj0 = Tjss + 5*ev(2,1);
% Fast response – perturbation in fast direction
% T0 = Tss + 5*ev(1,2); Tj0 = Tjss + 5*ev(2,2);
perturbedT = [T0 Tj0];
[t,TTj] = ode45(@(t,TTj) tankheater(t,TTj), [0 tfinal], perturbedT);
Tvec = TTj(:,1); Tjvec = TTj(:,2);
heattransferred = UA * (Tjvec(numel(t)) – Tvec(numel(t)));
figure;
plot(t,TTj,’o-‘)
xlabel(‘time, s’);
legend(‘Tank Temperature, oC’, ‘Jacket Temperature, oC’)
% Steady-state function
function f = tankheaterss(TTjss)
global Qss Qjss V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
T = TTjss(1);
Tj = TTjss(2);
f(1) = (Qss/V)*(Tinss-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qjss/Vj)*(Tjinss-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
end
% Dynamic function
function f = tankheater(t,TTj)
global Q Qj V Vj Tin Tjin cp cpj rho rhoj UA
T = TTj(1);
Tj = TTj(2);
f = zeros(2,1);
f(1) = (Q/V)*(Tin-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qj/Vj)*(Tjin-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
endclc; clearvars; close all; format short g; format compact;
global Qss Q Qjss Qj V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
% Q in m^3/s, V in m^3, T in oC, cp in J/kg K, rho in kg/m^3
% Physical properties
rho = 1000; rhoj = 1000; cp = 1269; cpj = 1269; UA = 1796; % J/K s
% Geometric parameters
V = 0.2832; Vj = 0.02832;
% Steady state process parameters
Qss = 4.719e-4; Qjss = 7.078e-4; Tinss = 10; Tjinss = 93.33;
% Actual process parameters
Q = 4.719e-4; Qj = 7.078e-4; Tin = 10; Tjin = 93.33;
% Tss = 51.67; Tjss = 65.56; % in oC (steady-state values from book)
% Linear stability analysis
A11 = -(Qss/V)-(UA/(rho*V*cp));
A12 = (UA/(rho*V*cp));
A21 = (UA/(rhoj*Vj*cpj));
A22 = -(Qjss/Vj)-(UA/(rhoj*Vj*cpj));
A = [A11 A12; A21 A22];
[ev, eval] = eig(A);
exitTs = fsolve(@tankheaterss,[10 101]);
Tss = exitTs(1); Tjss = exitTs(2);
tfinal = 2000;
T0 = Tss; Tj0 = Tjss;
% Slow response – perturbation in slow direction
% T0 = Tss + 5*ev(1,1); Tj0 = Tjss + 5*ev(2,1);
% Fast response – perturbation in fast direction
% T0 = Tss + 5*ev(1,2); Tj0 = Tjss + 5*ev(2,2);
perturbedT = [T0 Tj0];
[t,TTj] = ode45(@(t,TTj) tankheater(t,TTj), [0 tfinal], perturbedT);
Tvec = TTj(:,1); Tjvec = TTj(:,2);
heattransferred = UA * (Tjvec(numel(t)) – Tvec(numel(t)));
figure;
plot(t,TTj,’o-‘)
xlabel(‘time, s’);
legend(‘Tank Temperature, oC’, ‘Jacket Temperature, oC’)
% Steady-state function
function f = tankheaterss(TTjss)
global Qss Qjss V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
T = TTjss(1);
Tj = TTjss(2);
f(1) = (Qss/V)*(Tinss-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qjss/Vj)*(Tjinss-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
end
% Dynamic function
function f = tankheater(t,TTj)
global Q Qj V Vj Tin Tjin cp cpj rho rhoj UA
T = TTj(1);
Tj = TTj(2);
f = zeros(2,1);
f(1) = (Q/V)*(Tin-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qj/Vj)*(Tjin-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
end clc; clearvars; close all; format short g; format compact;
global Qss Q Qjss Qj V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
% Q in m^3/s, V in m^3, T in oC, cp in J/kg K, rho in kg/m^3
% Physical properties
rho = 1000; rhoj = 1000; cp = 1269; cpj = 1269; UA = 1796; % J/K s
% Geometric parameters
V = 0.2832; Vj = 0.02832;
% Steady state process parameters
Qss = 4.719e-4; Qjss = 7.078e-4; Tinss = 10; Tjinss = 93.33;
% Actual process parameters
Q = 4.719e-4; Qj = 7.078e-4; Tin = 10; Tjin = 93.33;
% Tss = 51.67; Tjss = 65.56; % in oC (steady-state values from book)
% Linear stability analysis
A11 = -(Qss/V)-(UA/(rho*V*cp));
A12 = (UA/(rho*V*cp));
A21 = (UA/(rhoj*Vj*cpj));
A22 = -(Qjss/Vj)-(UA/(rhoj*Vj*cpj));
A = [A11 A12; A21 A22];
[ev, eval] = eig(A);
exitTs = fsolve(@tankheaterss,[10 101]);
Tss = exitTs(1); Tjss = exitTs(2);
tfinal = 2000;
T0 = Tss; Tj0 = Tjss;
% Slow response – perturbation in slow direction
% T0 = Tss + 5*ev(1,1); Tj0 = Tjss + 5*ev(2,1);
% Fast response – perturbation in fast direction
% T0 = Tss + 5*ev(1,2); Tj0 = Tjss + 5*ev(2,2);
perturbedT = [T0 Tj0];
[t,TTj] = ode45(@(t,TTj) tankheater(t,TTj), [0 tfinal], perturbedT);
Tvec = TTj(:,1); Tjvec = TTj(:,2);
heattransferred = UA * (Tjvec(numel(t)) – Tvec(numel(t)));
figure;
plot(t,TTj,’o-‘)
xlabel(‘time, s’);
legend(‘Tank Temperature, oC’, ‘Jacket Temperature, oC’)
% Steady-state function
function f = tankheaterss(TTjss)
global Qss Qjss V Vj Tinss Tin Tjinss Tjin cp cpj rho rhoj UA
T = TTjss(1);
Tj = TTjss(2);
f(1) = (Qss/V)*(Tinss-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qjss/Vj)*(Tjinss-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
end
% Dynamic function
function f = tankheater(t,TTj)
global Q Qj V Vj Tin Tjin cp cpj rho rhoj UA
T = TTj(1);
Tj = TTj(2);
f = zeros(2,1);
f(1) = (Q/V)*(Tin-T) + (UA/(rho*V*cp))*(Tj-T);
f(2) = (Qj/Vj)*(Tjin-Tj) – (UA/(rhoj*Vj*cpj))*(Tj-T);
end ode23 MATLAB Answers — New Questions
How to interpolate 10 csv files with different x,y,z into a common grid and average them in MATLAB?
Hello,
I have 12 CSV files from a chromatic confocal sensor.
Each file has three columns: x, y, z.
The problem:
Each measurement has different x,y and z positions, since it is spirally scanning. I found x is more deviating than y and z.
I want to create a virtual reference surface by averaging these 12 measurements.
To do that, I need to interpolate each dataset onto the same (x,y) grid before averaging.
My questions:
How can I load all 10 CSVs and interpolate them onto a common regular grid in MATLAB?
2. What is the best function for interpolation in this case (griddata, scatteredInterpolant, or something else)?
3. Once all are on the same grid, how do I average the z-values to get one final reference surface and save it as a CSV?
Any example code or workflow would be greatly appreciated.
Thanks in advance!Hello,
I have 12 CSV files from a chromatic confocal sensor.
Each file has three columns: x, y, z.
The problem:
Each measurement has different x,y and z positions, since it is spirally scanning. I found x is more deviating than y and z.
I want to create a virtual reference surface by averaging these 12 measurements.
To do that, I need to interpolate each dataset onto the same (x,y) grid before averaging.
My questions:
How can I load all 10 CSVs and interpolate them onto a common regular grid in MATLAB?
2. What is the best function for interpolation in this case (griddata, scatteredInterpolant, or something else)?
3. Once all are on the same grid, how do I average the z-values to get one final reference surface and save it as a CSV?
Any example code or workflow would be greatly appreciated.
Thanks in advance! Hello,
I have 12 CSV files from a chromatic confocal sensor.
Each file has three columns: x, y, z.
The problem:
Each measurement has different x,y and z positions, since it is spirally scanning. I found x is more deviating than y and z.
I want to create a virtual reference surface by averaging these 12 measurements.
To do that, I need to interpolate each dataset onto the same (x,y) grid before averaging.
My questions:
How can I load all 10 CSVs and interpolate them onto a common regular grid in MATLAB?
2. What is the best function for interpolation in this case (griddata, scatteredInterpolant, or something else)?
3. Once all are on the same grid, how do I average the z-values to get one final reference surface and save it as a CSV?
Any example code or workflow would be greatly appreciated.
Thanks in advance! interpolation, averaging, csv, combine MATLAB Answers — New Questions