Tag Archives: matlab
CONVERT GRIB TO CSV/MAT
Hello,
I would like to know if there exists anyway to convert GRIB file to CSV/MAT in MATLAB. The GRIB file I downloaded from https://cds.climate.copernicus.eu/cd…e?tab=overview.
Let me know if this can be done in MATLABHello,
I would like to know if there exists anyway to convert GRIB file to CSV/MAT in MATLAB. The GRIB file I downloaded from https://cds.climate.copernicus.eu/cd…e?tab=overview.
Let me know if this can be done in MATLAB Hello,
I would like to know if there exists anyway to convert GRIB file to CSV/MAT in MATLAB. The GRIB file I downloaded from https://cds.climate.copernicus.eu/cd…e?tab=overview.
Let me know if this can be done in MATLAB grib file, copernicus data MATLAB Answers — New Questions
The particle swarm optimization algorithm optimizes the scale factor and quantization factor of the fuzzy PID controller
I want to use the particle swarm optimization algorithm to optimize the scale factor and quantization factor of the fuzzy PID controller, how do I do that? If I want to adjust the temperature of my cabin by controlling the speed of my compressor, can I set the difference between the actual temperature of the cabin and the set temperature as my objective function? My optimization goal was to control the cabin temperature, so that when there was a sudden disturbance from the outside world, my cabin would fluctuate less and correspondingly faster.I want to use the particle swarm optimization algorithm to optimize the scale factor and quantization factor of the fuzzy PID controller, how do I do that? If I want to adjust the temperature of my cabin by controlling the speed of my compressor, can I set the difference between the actual temperature of the cabin and the set temperature as my objective function? My optimization goal was to control the cabin temperature, so that when there was a sudden disturbance from the outside world, my cabin would fluctuate less and correspondingly faster. I want to use the particle swarm optimization algorithm to optimize the scale factor and quantization factor of the fuzzy PID controller, how do I do that? If I want to adjust the temperature of my cabin by controlling the speed of my compressor, can I set the difference between the actual temperature of the cabin and the set temperature as my objective function? My optimization goal was to control the cabin temperature, so that when there was a sudden disturbance from the outside world, my cabin would fluctuate less and correspondingly faster. particle swarm optimization algorithm,, fuzzy pid controller, MATLAB Answers — New Questions
Simulink Coder: no such file or directory
Hey there,
I want to get a s-function with Simulink Coder out of a BMS_strategy_EJ04_Diagmodel. when i run the model,it tell me :"Error(s) encountered while building model "BMS_strategy_EJ04_Diagmodel"".
The detail of the error message:
BMS_strategy_EJ04_Diagmodel.mk:171: D:/Program: No such file or directory
BMS_strategy_EJ04_Diagmodel.mk:171: Files/MATLAB/R2011brtwctoolslcctools.mak: No such file or directory
gmake: *** No rule to make target `Files/MATLAB/R2011brtwctoolslcctools.mak’. Stop.
Well, it seems the path in line 171 is not working right. so i hope you can help me to slove this problem.
thank you !!
yours
miss LeeHey there,
I want to get a s-function with Simulink Coder out of a BMS_strategy_EJ04_Diagmodel. when i run the model,it tell me :"Error(s) encountered while building model "BMS_strategy_EJ04_Diagmodel"".
The detail of the error message:
BMS_strategy_EJ04_Diagmodel.mk:171: D:/Program: No such file or directory
BMS_strategy_EJ04_Diagmodel.mk:171: Files/MATLAB/R2011brtwctoolslcctools.mak: No such file or directory
gmake: *** No rule to make target `Files/MATLAB/R2011brtwctoolslcctools.mak’. Stop.
Well, it seems the path in line 171 is not working right. so i hope you can help me to slove this problem.
thank you !!
yours
miss Lee Hey there,
I want to get a s-function with Simulink Coder out of a BMS_strategy_EJ04_Diagmodel. when i run the model,it tell me :"Error(s) encountered while building model "BMS_strategy_EJ04_Diagmodel"".
The detail of the error message:
BMS_strategy_EJ04_Diagmodel.mk:171: D:/Program: No such file or directory
BMS_strategy_EJ04_Diagmodel.mk:171: Files/MATLAB/R2011brtwctoolslcctools.mak: No such file or directory
gmake: *** No rule to make target `Files/MATLAB/R2011brtwctoolslcctools.mak’. Stop.
Well, it seems the path in line 171 is not working right. so i hope you can help me to slove this problem.
thank you !!
yours
miss Lee stateflow, code generation MATLAB Answers — New Questions
빌드 에러 문의 건
오류:The call to autosar_make_rtw_hook, during the entry hook generated the following error:
Short name ‘FlushHandle_Impl’ (Package /Components/SwcImplementations/FlushHandle_Impl) failed uniqueness tests, because short name ‘FlushHandle_Impl’ (SwcImplementation /Components/SwcImplementations/FlushHandle_Impl) already exists. AUTOSAR constraint 2508 (CONSTR_2508) requires uniqueness tests to be case insensitive. To comply with the constraint, change one of the short names.
The build process will terminate as a result.
원인:
Short name ‘FlushHandle_Impl’ (Package /Components/SwcImplementations/FlushHandle_Impl) failed uniqueness tests, because short name ‘FlushHandle_Impl’ (SwcImplementation /Components/SwcImplementations/FlushHandle_Impl) already exists. AUTOSAR constraint 2508 (CONSTR_2508) requires uniqueness tests to be case insensitive. To comply with the constraint, change one of the short names.
이런 에러가 있는대 어떻게 수정하면 될까요?오류:The call to autosar_make_rtw_hook, during the entry hook generated the following error:
Short name ‘FlushHandle_Impl’ (Package /Components/SwcImplementations/FlushHandle_Impl) failed uniqueness tests, because short name ‘FlushHandle_Impl’ (SwcImplementation /Components/SwcImplementations/FlushHandle_Impl) already exists. AUTOSAR constraint 2508 (CONSTR_2508) requires uniqueness tests to be case insensitive. To comply with the constraint, change one of the short names.
The build process will terminate as a result.
원인:
Short name ‘FlushHandle_Impl’ (Package /Components/SwcImplementations/FlushHandle_Impl) failed uniqueness tests, because short name ‘FlushHandle_Impl’ (SwcImplementation /Components/SwcImplementations/FlushHandle_Impl) already exists. AUTOSAR constraint 2508 (CONSTR_2508) requires uniqueness tests to be case insensitive. To comply with the constraint, change one of the short names.
이런 에러가 있는대 어떻게 수정하면 될까요? 오류:The call to autosar_make_rtw_hook, during the entry hook generated the following error:
Short name ‘FlushHandle_Impl’ (Package /Components/SwcImplementations/FlushHandle_Impl) failed uniqueness tests, because short name ‘FlushHandle_Impl’ (SwcImplementation /Components/SwcImplementations/FlushHandle_Impl) already exists. AUTOSAR constraint 2508 (CONSTR_2508) requires uniqueness tests to be case insensitive. To comply with the constraint, change one of the short names.
The build process will terminate as a result.
원인:
Short name ‘FlushHandle_Impl’ (Package /Components/SwcImplementations/FlushHandle_Impl) failed uniqueness tests, because short name ‘FlushHandle_Impl’ (SwcImplementation /Components/SwcImplementations/FlushHandle_Impl) already exists. AUTOSAR constraint 2508 (CONSTR_2508) requires uniqueness tests to be case insensitive. To comply with the constraint, change one of the short names.
이런 에러가 있는대 어떻게 수정하면 될까요? simulink, code generation MATLAB Answers — New Questions
how do i give flag to this condition
Design an Up-counter using Simulink Blocks:
The counter shall go uptill 10 counts with an incremental of 2.
After 10 counts, it should be reset to 0 and shall set a flag.
The flag (initial value =0) shall be reset after 20.
Display the flag at every sample time.Design an Up-counter using Simulink Blocks:
The counter shall go uptill 10 counts with an incremental of 2.
After 10 counts, it should be reset to 0 and shall set a flag.
The flag (initial value =0) shall be reset after 20.
Display the flag at every sample time. Design an Up-counter using Simulink Blocks:
The counter shall go uptill 10 counts with an incremental of 2.
After 10 counts, it should be reset to 0 and shall set a flag.
The flag (initial value =0) shall be reset after 20.
Display the flag at every sample time. flag, upcounter MATLAB Answers — New Questions
MATLAB FUNDAMENTALS COURSE self paced course
Good evening Sir,
I am doing MATLAB FUNDAMENTALS self-paced online course. In the topic of Accessing multiple elements of an array in last excersise,task1 though i used proper command t extract the elements of a matrix, it is showing error .In the web based browser i am getting correct o/p on the right side pane, but in the course side pane on left it is showing error. Please give solution.Good evening Sir,
I am doing MATLAB FUNDAMENTALS self-paced online course. In the topic of Accessing multiple elements of an array in last excersise,task1 though i used proper command t extract the elements of a matrix, it is showing error .In the web based browser i am getting correct o/p on the right side pane, but in the course side pane on left it is showing error. Please give solution. Good evening Sir,
I am doing MATLAB FUNDAMENTALS self-paced online course. In the topic of Accessing multiple elements of an array in last excersise,task1 though i used proper command t extract the elements of a matrix, it is showing error .In the web based browser i am getting correct o/p on the right side pane, but in the course side pane on left it is showing error. Please give solution. access data in arrays MATLAB Answers — New Questions
How to draw a graph like the image attached below in MATLAB
Hello, experts.
I would like to draw the picture below using Matlab. What function can I use to plot it?Hello, experts.
I would like to draw the picture below using Matlab. What function can I use to plot it? Hello, experts.
I would like to draw the picture below using Matlab. What function can I use to plot it? graph, plot MATLAB Answers — New Questions
Copying a figure with black background not working
I want to copy and paste my figure onto ppt.
I have made a figure using black background
This is what it looks like in open figure window:
However if I directly copy and paste it to ppt from the edit menu, it looks like this:
When I save it as jpg, this is what it looks like:
How to solve this issue?
Part of the code: (I am not sure if the way to make the background as black is the issue)
fig = figure;
fig.Color = ‘k’; % figure background color black
tiledlayout(1, (num_days), ‘TileSpacing’, ‘compact’, ‘Padding’, ‘compact’);
% code to generate figure
ax = nexttile; % made it as I have to change the axis to white and background to black
% Set the axes background color to black
ax.Color = ‘k’; % sets the axes color to black
% Adjust the colors for axes and grid to be more visible against the black background
ax.XColor = ‘w’; % sets the x-axis line color to white
ax.YColor = ‘w’; % sets the y-axis line color to white
ax.GridColor = ‘w’; % sets the grid lines color to white (if visible grid is present)I want to copy and paste my figure onto ppt.
I have made a figure using black background
This is what it looks like in open figure window:
However if I directly copy and paste it to ppt from the edit menu, it looks like this:
When I save it as jpg, this is what it looks like:
How to solve this issue?
Part of the code: (I am not sure if the way to make the background as black is the issue)
fig = figure;
fig.Color = ‘k’; % figure background color black
tiledlayout(1, (num_days), ‘TileSpacing’, ‘compact’, ‘Padding’, ‘compact’);
% code to generate figure
ax = nexttile; % made it as I have to change the axis to white and background to black
% Set the axes background color to black
ax.Color = ‘k’; % sets the axes color to black
% Adjust the colors for axes and grid to be more visible against the black background
ax.XColor = ‘w’; % sets the x-axis line color to white
ax.YColor = ‘w’; % sets the y-axis line color to white
ax.GridColor = ‘w’; % sets the grid lines color to white (if visible grid is present) I want to copy and paste my figure onto ppt.
I have made a figure using black background
This is what it looks like in open figure window:
However if I directly copy and paste it to ppt from the edit menu, it looks like this:
When I save it as jpg, this is what it looks like:
How to solve this issue?
Part of the code: (I am not sure if the way to make the background as black is the issue)
fig = figure;
fig.Color = ‘k’; % figure background color black
tiledlayout(1, (num_days), ‘TileSpacing’, ‘compact’, ‘Padding’, ‘compact’);
% code to generate figure
ax = nexttile; % made it as I have to change the axis to white and background to black
% Set the axes background color to black
ax.Color = ‘k’; % sets the axes color to black
% Adjust the colors for axes and grid to be more visible against the black background
ax.XColor = ‘w’; % sets the x-axis line color to white
ax.YColor = ‘w’; % sets the y-axis line color to white
ax.GridColor = ‘w’; % sets the grid lines color to white (if visible grid is present) figure, copy MATLAB Answers — New Questions
connect variable signals with signal builder or equivalent block using M Script
I have a .mat file that contains various signals and their corresponding values. I also have a model file that contains similar signal names in inport blocks, which are connected to a subsystem. However, the values of these signals in the model file differ from the values in the .mat file.My task is to match the signals of the inport blocks to the signals in the .mat file. If a signal is present in both files, I need to assign the .mat signal and its value to the corresponding inport block in the model. Instead of using the inport block, I need to use a Signal Builder block (or a similar block that I’m not currently aware of).The reason for using a Signal Builder block is that it allows me to assign both the signal value and time to the block. This way, I can directly test the model by running it.In the input files, I will provide:
A model file containing inport blocks
A .mat file
I will write a script that compares the signals in the model file with the signals in the .mat file. If any signals in the model file match the signals in the .mat file, the script will assign the .mat signal values to the corresponding Signal Builder blocks in the model.After making these changes, I will store the updated model file separately without modifying the original model file. it is possible to perform this task and how ?I have a .mat file that contains various signals and their corresponding values. I also have a model file that contains similar signal names in inport blocks, which are connected to a subsystem. However, the values of these signals in the model file differ from the values in the .mat file.My task is to match the signals of the inport blocks to the signals in the .mat file. If a signal is present in both files, I need to assign the .mat signal and its value to the corresponding inport block in the model. Instead of using the inport block, I need to use a Signal Builder block (or a similar block that I’m not currently aware of).The reason for using a Signal Builder block is that it allows me to assign both the signal value and time to the block. This way, I can directly test the model by running it.In the input files, I will provide:
A model file containing inport blocks
A .mat file
I will write a script that compares the signals in the model file with the signals in the .mat file. If any signals in the model file match the signals in the .mat file, the script will assign the .mat signal values to the corresponding Signal Builder blocks in the model.After making these changes, I will store the updated model file separately without modifying the original model file. it is possible to perform this task and how ? I have a .mat file that contains various signals and their corresponding values. I also have a model file that contains similar signal names in inport blocks, which are connected to a subsystem. However, the values of these signals in the model file differ from the values in the .mat file.My task is to match the signals of the inport blocks to the signals in the .mat file. If a signal is present in both files, I need to assign the .mat signal and its value to the corresponding inport block in the model. Instead of using the inport block, I need to use a Signal Builder block (or a similar block that I’m not currently aware of).The reason for using a Signal Builder block is that it allows me to assign both the signal value and time to the block. This way, I can directly test the model by running it.In the input files, I will provide:
A model file containing inport blocks
A .mat file
I will write a script that compares the signals in the model file with the signals in the .mat file. If any signals in the model file match the signals in the .mat file, the script will assign the .mat signal values to the corresponding Signal Builder blocks in the model.After making these changes, I will store the updated model file separately without modifying the original model file. it is possible to perform this task and how ? #mscript #signalbuilder #matfile #modeldataextract MATLAB Answers — New Questions
summations of combinations of elements, one from each column of a 2D matrix, in small to large order
I have a 2D numerical matrix of size 1000 by 8: [0 a1 a2 a3 a4 … a999; 0 b1 b2 b3 b4 … b999; … ; 0 h1 h2 h3 h4 … h999]’ , where each column is in ascending order, i.e., 0<a1<a2<a3<…<a999, etc. However, I don’t know how a1 compares to b1, or c1, etc. For example, b100 could be smaller than a1.
Now, I would like to find the first 1000,000 combinations of 8 elements, each coming from a column, that have the smallest summation values. For each combination, I would like to retain the row and column indices of each element as well.
Can anyone help me with the problem? Thank you very much for your help in advance.I have a 2D numerical matrix of size 1000 by 8: [0 a1 a2 a3 a4 … a999; 0 b1 b2 b3 b4 … b999; … ; 0 h1 h2 h3 h4 … h999]’ , where each column is in ascending order, i.e., 0<a1<a2<a3<…<a999, etc. However, I don’t know how a1 compares to b1, or c1, etc. For example, b100 could be smaller than a1.
Now, I would like to find the first 1000,000 combinations of 8 elements, each coming from a column, that have the smallest summation values. For each combination, I would like to retain the row and column indices of each element as well.
Can anyone help me with the problem? Thank you very much for your help in advance. I have a 2D numerical matrix of size 1000 by 8: [0 a1 a2 a3 a4 … a999; 0 b1 b2 b3 b4 … b999; … ; 0 h1 h2 h3 h4 … h999]’ , where each column is in ascending order, i.e., 0<a1<a2<a3<…<a999, etc. However, I don’t know how a1 compares to b1, or c1, etc. For example, b100 could be smaller than a1.
Now, I would like to find the first 1000,000 combinations of 8 elements, each coming from a column, that have the smallest summation values. For each combination, I would like to retain the row and column indices of each element as well.
Can anyone help me with the problem? Thank you very much for your help in advance. combinations, summation, order MATLAB Answers — New Questions
ROS 2 Dashing and Gazebo
Hi,
I am doing the installation of the ROS 2 Dashing and Gazebo as seen here
I am wokring on windows and have the VM installed and sucessfully have the ros_melodic_dashing_gazebov9.vmx operating.
When trying to use the worlds on my desktop, they simply open a terminal windows for a split second and then close again. It seems that they crash or Gazebo runs into issues and fails to open any of the worlds.
I have also tried this in conjunciton with the differetial drive example here . Which indicates to use
export SVGA_VGPU10=0
before opening the world, however this does not work either.
Any suggestions as to what is the problem?
Thanks,
RobHi,
I am doing the installation of the ROS 2 Dashing and Gazebo as seen here
I am wokring on windows and have the VM installed and sucessfully have the ros_melodic_dashing_gazebov9.vmx operating.
When trying to use the worlds on my desktop, they simply open a terminal windows for a split second and then close again. It seems that they crash or Gazebo runs into issues and fails to open any of the worlds.
I have also tried this in conjunciton with the differetial drive example here . Which indicates to use
export SVGA_VGPU10=0
before opening the world, however this does not work either.
Any suggestions as to what is the problem?
Thanks,
Rob Hi,
I am doing the installation of the ROS 2 Dashing and Gazebo as seen here
I am wokring on windows and have the VM installed and sucessfully have the ros_melodic_dashing_gazebov9.vmx operating.
When trying to use the worlds on my desktop, they simply open a terminal windows for a split second and then close again. It seems that they crash or Gazebo runs into issues and fails to open any of the worlds.
I have also tried this in conjunciton with the differetial drive example here . Which indicates to use
export SVGA_VGPU10=0
before opening the world, however this does not work either.
Any suggestions as to what is the problem?
Thanks,
Rob matlab, ros, gazebo, dashing, ros 2, vm, crashing MATLAB Answers — New Questions
Can’t dewarp image using fitgeotform2d and imwarp
I’m trying to reverse a transformation in an image. I have point coordinates in the intrinsic coordinate (moving points) and their equivalent in the real world coordinates (fixed points). When I use the fitgeotform2d and imwarp functions to obtained a dewarped image, I only get an matrix of zeros and size of the original image as output. Here’s the data and the code:
load("calImg.mat")
J = double(calImg);
fixedPoints = W;
movingPoints = I;
figure(1)
imagesc(J)
tform = fitgeotform2d(movingPoints,fixedPoints,"projective");
Jregistered = imwarp(flipud(J),tform,OutputView=imref2d(size(J)));
figure(2)
imshowpair(I,Jregistered)I’m trying to reverse a transformation in an image. I have point coordinates in the intrinsic coordinate (moving points) and their equivalent in the real world coordinates (fixed points). When I use the fitgeotform2d and imwarp functions to obtained a dewarped image, I only get an matrix of zeros and size of the original image as output. Here’s the data and the code:
load("calImg.mat")
J = double(calImg);
fixedPoints = W;
movingPoints = I;
figure(1)
imagesc(J)
tform = fitgeotform2d(movingPoints,fixedPoints,"projective");
Jregistered = imwarp(flipud(J),tform,OutputView=imref2d(size(J)));
figure(2)
imshowpair(I,Jregistered) I’m trying to reverse a transformation in an image. I have point coordinates in the intrinsic coordinate (moving points) and their equivalent in the real world coordinates (fixed points). When I use the fitgeotform2d and imwarp functions to obtained a dewarped image, I only get an matrix of zeros and size of the original image as output. Here’s the data and the code:
load("calImg.mat")
J = double(calImg);
fixedPoints = W;
movingPoints = I;
figure(1)
imagesc(J)
tform = fitgeotform2d(movingPoints,fixedPoints,"projective");
Jregistered = imwarp(flipud(J),tform,OutputView=imref2d(size(J)));
figure(2)
imshowpair(I,Jregistered) fitgeotform2d, imwarp, image processing, image analysis MATLAB Answers — New Questions
Support for Multiplication and Transpose of Block Matrices of Symbolic Matrices?
Does MATLAB not support multiplying and transposing block symbolic matrices? For instance, the following multiplication and transpose are not evaluated on the individual matrices inside of the block matrices:
syms A B C D E F G H [2 2] matrix
X = [A B;C D].’
Y = [A B;C D]*[E F;G H]
The outputs I am expecting are:
X = [A.’ C.’;B.’ D.’]
Y = [A*E+B*G A*F+B*H;C*E+D*G C*F+D*H]Does MATLAB not support multiplying and transposing block symbolic matrices? For instance, the following multiplication and transpose are not evaluated on the individual matrices inside of the block matrices:
syms A B C D E F G H [2 2] matrix
X = [A B;C D].’
Y = [A B;C D]*[E F;G H]
The outputs I am expecting are:
X = [A.’ C.’;B.’ D.’]
Y = [A*E+B*G A*F+B*H;C*E+D*G C*F+D*H] Does MATLAB not support multiplying and transposing block symbolic matrices? For instance, the following multiplication and transpose are not evaluated on the individual matrices inside of the block matrices:
syms A B C D E F G H [2 2] matrix
X = [A B;C D].’
Y = [A B;C D]*[E F;G H]
The outputs I am expecting are:
X = [A.’ C.’;B.’ D.’]
Y = [A*E+B*G A*F+B*H;C*E+D*G C*F+D*H] symbolic, block matrix, symbolic block matrix, symbolic matrix, symmatrix, symbolic matrix variable, multiplication, transpose, matlab, matrix, mathematics, livescript MATLAB Answers — New Questions
Show coordinates for a 2D point in a table cell
I’m working on a MATLAB app where I’m trying to dynamically record and show every mouse click on the UIAxes in a UItable.
My problem is that the table only shows "1×2 double" in the designated cell for the coordinates instead of the actual numbers.
Is this possible to fix or do I have to split them into two columns?
app.PointsTable.Data = table(‘Size’,[0 2],’VariableNames’, {‘Point’, ‘Coordinates’}, ‘VariableTypes’, {‘uint8’, ‘cell’});
function UIAxesButtonDown(app, event)
if 1
coordinates = app.UIAxes.CurrentPoint(1, 1:2);
numRows = size(app.PointsTable.Data, 1);
app.PointsTable.Data(numRows+1, 🙂 = {numRows+1, {[coordinates(1) coordinates(2)]}};
end
endI’m working on a MATLAB app where I’m trying to dynamically record and show every mouse click on the UIAxes in a UItable.
My problem is that the table only shows "1×2 double" in the designated cell for the coordinates instead of the actual numbers.
Is this possible to fix or do I have to split them into two columns?
app.PointsTable.Data = table(‘Size’,[0 2],’VariableNames’, {‘Point’, ‘Coordinates’}, ‘VariableTypes’, {‘uint8’, ‘cell’});
function UIAxesButtonDown(app, event)
if 1
coordinates = app.UIAxes.CurrentPoint(1, 1:2);
numRows = size(app.PointsTable.Data, 1);
app.PointsTable.Data(numRows+1, 🙂 = {numRows+1, {[coordinates(1) coordinates(2)]}};
end
end I’m working on a MATLAB app where I’m trying to dynamically record and show every mouse click on the UIAxes in a UItable.
My problem is that the table only shows "1×2 double" in the designated cell for the coordinates instead of the actual numbers.
Is this possible to fix or do I have to split them into two columns?
app.PointsTable.Data = table(‘Size’,[0 2],’VariableNames’, {‘Point’, ‘Coordinates’}, ‘VariableTypes’, {‘uint8’, ‘cell’});
function UIAxesButtonDown(app, event)
if 1
coordinates = app.UIAxes.CurrentPoint(1, 1:2);
numRows = size(app.PointsTable.Data, 1);
app.PointsTable.Data(numRows+1, 🙂 = {numRows+1, {[coordinates(1) coordinates(2)]}};
end
end uitable, cell MATLAB Answers — New Questions
I encounter a memory leak warning when i simulate my simulink model from a GA optimization code which iteratively simulate my model
Here’s the warning message :
Warning: Internal warning: A JITEngine loaded for block simulation cannot be freed due to non-zero reference count. It is usually caused by
unpaired calls to a block’s "setupRuntimeResources" and "cleanupRuntimeResources" methods.
> In optimising2_3 (line 209)
In Run_fuzzyGA_Tunning_R1 (line 79)Here’s the warning message :
Warning: Internal warning: A JITEngine loaded for block simulation cannot be freed due to non-zero reference count. It is usually caused by
unpaired calls to a block’s "setupRuntimeResources" and "cleanupRuntimeResources" methods.
> In optimising2_3 (line 209)
In Run_fuzzyGA_Tunning_R1 (line 79) Here’s the warning message :
Warning: Internal warning: A JITEngine loaded for block simulation cannot be freed due to non-zero reference count. It is usually caused by
unpaired calls to a block’s "setupRuntimeResources" and "cleanupRuntimeResources" methods.
> In optimising2_3 (line 209)
In Run_fuzzyGA_Tunning_R1 (line 79) simulink, setupruntimeresources, cleanupruntimeresources, jitengine MATLAB Answers — New Questions
Error: Data must be numeric, datetime, duration, categorical, or an array convertible to double.
Hello everyone,
I am trying to plot a function that has two different variables: theta and phi.
Theta = -pi/2:0.1:pi/2
Phi = Specific Values at 0 and pi/2
I have an error that says:
"Error: Data must be numeric, datetime, duration, categorical, or an array convertible to double."
I’ve tried looking up this error on different discussions. However, I wasn’t able to find anything that helped with my specific scenario.
I have tried different methods and approaches: Using "symbolic variables", fimplicit function, fplot function, etc. However, I got different errors everytime I tried a different approach.
I attached my code for reference:
Plotting_Theta_Phi_Function.mHello everyone,
I am trying to plot a function that has two different variables: theta and phi.
Theta = -pi/2:0.1:pi/2
Phi = Specific Values at 0 and pi/2
I have an error that says:
"Error: Data must be numeric, datetime, duration, categorical, or an array convertible to double."
I’ve tried looking up this error on different discussions. However, I wasn’t able to find anything that helped with my specific scenario.
I have tried different methods and approaches: Using "symbolic variables", fimplicit function, fplot function, etc. However, I got different errors everytime I tried a different approach.
I attached my code for reference:
Plotting_Theta_Phi_Function.m Hello everyone,
I am trying to plot a function that has two different variables: theta and phi.
Theta = -pi/2:0.1:pi/2
Phi = Specific Values at 0 and pi/2
I have an error that says:
"Error: Data must be numeric, datetime, duration, categorical, or an array convertible to double."
I’ve tried looking up this error on different discussions. However, I wasn’t able to find anything that helped with my specific scenario.
I have tried different methods and approaches: Using "symbolic variables", fimplicit function, fplot function, etc. However, I got different errors everytime I tried a different approach.
I attached my code for reference:
Plotting_Theta_Phi_Function.m plotting, functions MATLAB Answers — New Questions
How to create a summation looping through one matrix while keeping another one constant?
Hi,
I have a function "Func" that takes 2 inputs, 1 from each a different matrix (A and B). The matrices have same number of rows, but different number of columns.
My output matrix, C, takes the summation of Func’s output. For the entire row of matrix B, we will keep A constant. We will only go onto the next value of A when the B row is done. Additionally, we keep the rows the same such that only row 1 matrix B values will be used with row 1 A values. Row 2 matrix B with row 2 matrix A. etc. Here’s the demo code showing what I need it to do:
A = [1, 2, 3, 4;
5, 6, 7, 8;
9, 10, 11, 12];
B = [13, 14;
15, 16;
17, 18];
% Notes:
% Input A is a 3×4 matrix
% Input B is a 3×2 matrix
% Output C is going to be same dimensions as A, 3×4
% Function "Func" takes in inputs from A and B. syntax =
% Func(input from A, input from B)
% Example of how this is supposed to look:
% C(1,1) = Func(1,13) + Func(1,14)
% Above meaning the 1,1 entry of C matrix is the summation of the output of function "Func" where the inputs is A(1,1) and B(1,1) and B(1,2)
% C(1,2) = Func(2,13) + Func(2,14)
% C(1,3) = Func(3,13) + Func(3,14)
….
% C(2,1) = Func(5,15) + Func(5,16)
% Now that we are in the 2nd row, the "Func" function uses inputs A(2,1) and B(2,1) and B(2,2)
% C(2,2) = Func(6,15) + Func(6,16)
….
% C(3,1) = Func(9,17) + Func(9,18)
….
% C(3,4) = Func(12,17) + Func(12,18)
I know how to do this brute force, but I am struggling with how to approach this problem:
How many for loops do I need? (I currently have 2)
How do I get the loop to calculate the summation? Right now, my loop is only calculating the instaneous value, not summing.
Thanks!Hi,
I have a function "Func" that takes 2 inputs, 1 from each a different matrix (A and B). The matrices have same number of rows, but different number of columns.
My output matrix, C, takes the summation of Func’s output. For the entire row of matrix B, we will keep A constant. We will only go onto the next value of A when the B row is done. Additionally, we keep the rows the same such that only row 1 matrix B values will be used with row 1 A values. Row 2 matrix B with row 2 matrix A. etc. Here’s the demo code showing what I need it to do:
A = [1, 2, 3, 4;
5, 6, 7, 8;
9, 10, 11, 12];
B = [13, 14;
15, 16;
17, 18];
% Notes:
% Input A is a 3×4 matrix
% Input B is a 3×2 matrix
% Output C is going to be same dimensions as A, 3×4
% Function "Func" takes in inputs from A and B. syntax =
% Func(input from A, input from B)
% Example of how this is supposed to look:
% C(1,1) = Func(1,13) + Func(1,14)
% Above meaning the 1,1 entry of C matrix is the summation of the output of function "Func" where the inputs is A(1,1) and B(1,1) and B(1,2)
% C(1,2) = Func(2,13) + Func(2,14)
% C(1,3) = Func(3,13) + Func(3,14)
….
% C(2,1) = Func(5,15) + Func(5,16)
% Now that we are in the 2nd row, the "Func" function uses inputs A(2,1) and B(2,1) and B(2,2)
% C(2,2) = Func(6,15) + Func(6,16)
….
% C(3,1) = Func(9,17) + Func(9,18)
….
% C(3,4) = Func(12,17) + Func(12,18)
I know how to do this brute force, but I am struggling with how to approach this problem:
How many for loops do I need? (I currently have 2)
How do I get the loop to calculate the summation? Right now, my loop is only calculating the instaneous value, not summing.
Thanks! Hi,
I have a function "Func" that takes 2 inputs, 1 from each a different matrix (A and B). The matrices have same number of rows, but different number of columns.
My output matrix, C, takes the summation of Func’s output. For the entire row of matrix B, we will keep A constant. We will only go onto the next value of A when the B row is done. Additionally, we keep the rows the same such that only row 1 matrix B values will be used with row 1 A values. Row 2 matrix B with row 2 matrix A. etc. Here’s the demo code showing what I need it to do:
A = [1, 2, 3, 4;
5, 6, 7, 8;
9, 10, 11, 12];
B = [13, 14;
15, 16;
17, 18];
% Notes:
% Input A is a 3×4 matrix
% Input B is a 3×2 matrix
% Output C is going to be same dimensions as A, 3×4
% Function "Func" takes in inputs from A and B. syntax =
% Func(input from A, input from B)
% Example of how this is supposed to look:
% C(1,1) = Func(1,13) + Func(1,14)
% Above meaning the 1,1 entry of C matrix is the summation of the output of function "Func" where the inputs is A(1,1) and B(1,1) and B(1,2)
% C(1,2) = Func(2,13) + Func(2,14)
% C(1,3) = Func(3,13) + Func(3,14)
….
% C(2,1) = Func(5,15) + Func(5,16)
% Now that we are in the 2nd row, the "Func" function uses inputs A(2,1) and B(2,1) and B(2,2)
% C(2,2) = Func(6,15) + Func(6,16)
….
% C(3,1) = Func(9,17) + Func(9,18)
….
% C(3,4) = Func(12,17) + Func(12,18)
I know how to do this brute force, but I am struggling with how to approach this problem:
How many for loops do I need? (I currently have 2)
How do I get the loop to calculate the summation? Right now, my loop is only calculating the instaneous value, not summing.
Thanks! help, for loop, sum MATLAB Answers — New Questions
The command line isn’t working on matlab online, and the workspace and other features on the side bar also don’t seem to be working.
Pressing the command line button or the workspace button just extends the border it doesn’t actually open them up. Up until this point, I’ve been working in a .mlx file.Pressing the command line button or the workspace button just extends the border it doesn’t actually open them up. Up until this point, I’ve been working in a .mlx file. Pressing the command line button or the workspace button just extends the border it doesn’t actually open them up. Up until this point, I’ve been working in a .mlx file. command line, workspace MATLAB Answers — New Questions
When plotting multiple subplots in the for loop, how do you stop the axes from overlapping?
I am trying to plot the suplots in the for loop using the following code:
for k = 1:length(txt_files)
% some code
if PWM_switch == 1
ax1 = axes(t);
ax1.Layout.Tile = Test_Case;
if mod_switch == 1
if OpenLoop == 0
plot(table.data(:,1), table.data(:,2), ‘k’); hold on;
elseif OpenLoop == 1
plot(table.data(:,1), table.data(:,2), ‘k–‘); hold on;
end
end
if mod_switch == 4
if OpenLoop == 0
plot(table.data(:,1), table.data(:,2), ‘r’); hold on;
elseif OpenLoop == 1
plot(table.data(:,1), table.data(:,2), ‘r–‘); hold on;
end
end
end
end
but it appears that every time ax1 = axes(t) is executed, the supplot gets overlapping. You can still see old y-axis scales, but only the latest plots. When I run the loop step-by-step, all plots are plotted in the correct subplots; only they are overlapping.
I need to switch between subplots based on the conditions, i.e., Test Cases.
ax1.Layout.Tile = Test_Case correctly locates the subplot.
The full code with all *.txt files is in the attachment.I am trying to plot the suplots in the for loop using the following code:
for k = 1:length(txt_files)
% some code
if PWM_switch == 1
ax1 = axes(t);
ax1.Layout.Tile = Test_Case;
if mod_switch == 1
if OpenLoop == 0
plot(table.data(:,1), table.data(:,2), ‘k’); hold on;
elseif OpenLoop == 1
plot(table.data(:,1), table.data(:,2), ‘k–‘); hold on;
end
end
if mod_switch == 4
if OpenLoop == 0
plot(table.data(:,1), table.data(:,2), ‘r’); hold on;
elseif OpenLoop == 1
plot(table.data(:,1), table.data(:,2), ‘r–‘); hold on;
end
end
end
end
but it appears that every time ax1 = axes(t) is executed, the supplot gets overlapping. You can still see old y-axis scales, but only the latest plots. When I run the loop step-by-step, all plots are plotted in the correct subplots; only they are overlapping.
I need to switch between subplots based on the conditions, i.e., Test Cases.
ax1.Layout.Tile = Test_Case correctly locates the subplot.
The full code with all *.txt files is in the attachment. I am trying to plot the suplots in the for loop using the following code:
for k = 1:length(txt_files)
% some code
if PWM_switch == 1
ax1 = axes(t);
ax1.Layout.Tile = Test_Case;
if mod_switch == 1
if OpenLoop == 0
plot(table.data(:,1), table.data(:,2), ‘k’); hold on;
elseif OpenLoop == 1
plot(table.data(:,1), table.data(:,2), ‘k–‘); hold on;
end
end
if mod_switch == 4
if OpenLoop == 0
plot(table.data(:,1), table.data(:,2), ‘r’); hold on;
elseif OpenLoop == 1
plot(table.data(:,1), table.data(:,2), ‘r–‘); hold on;
end
end
end
end
but it appears that every time ax1 = axes(t) is executed, the supplot gets overlapping. You can still see old y-axis scales, but only the latest plots. When I run the loop step-by-step, all plots are plotted in the correct subplots; only they are overlapping.
I need to switch between subplots based on the conditions, i.e., Test Cases.
ax1.Layout.Tile = Test_Case correctly locates the subplot.
The full code with all *.txt files is in the attachment. plotting, subplot, axes MATLAB Answers — New Questions
System Composer addition to suite
System composer cannot be learned in just a few days or weeks. I have a home license so I can learn and apply to the commercial version when able. I have purchased many of the home licenses…seems silly that I cannot prepare (learn) for a commercial MBSE endeavor. When look for the compatible version price I CANNOT find it.System composer cannot be learned in just a few days or weeks. I have a home license so I can learn and apply to the commercial version when able. I have purchased many of the home licenses…seems silly that I cannot prepare (learn) for a commercial MBSE endeavor. When look for the compatible version price I CANNOT find it. System composer cannot be learned in just a few days or weeks. I have a home license so I can learn and apply to the commercial version when able. I have purchased many of the home licenses…seems silly that I cannot prepare (learn) for a commercial MBSE endeavor. When look for the compatible version price I CANNOT find it. simulink composer MATLAB Answers — New Questions