Tag Archives: matlab
How to plot and calculate 95% confidence interval
Hello,
I have two vectors of the actual values and predicted values and I want to calculate and plot 95% confidenence interval just like the image I have attached. Colud you please help me?
thanks a lot.Hello,
I have two vectors of the actual values and predicted values and I want to calculate and plot 95% confidenence interval just like the image I have attached. Colud you please help me?
thanks a lot. Hello,
I have two vectors of the actual values and predicted values and I want to calculate and plot 95% confidenence interval just like the image I have attached. Colud you please help me?
thanks a lot. matlab, plot, machine learning MATLAB Answers — New Questions
Increasing the line width of box plot whiskers
I have written some code to produce 2 boxplots side by side using tiledlayout. I would like to increase the line weight of the boxes and the whiskers and have written the code to do so as follows:
figure()
t = tiledlayout(1,2,’tilespacing’,’none’);
nexttile
boxplot(T_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx1 = findobj(‘Tag’,’boxplot’);
set(bx1.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
nexttile
boxplot(S_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx2 = findobj(‘Tag’,’boxplot’);
set(bx2.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
The first time I run this code, the first tile runs successfully and I get the following error message for the second tile:
Error using matlab.graphics.primitive.Line/set
Invalid parameter/value pair arguments.
Error in Filename (line XXX)
set(bx2.Children,’LineWidth’,2)
If I then do nothing, just hit enter again to re-run the cell, it then fails with the same error, but now for the first tile – and does not reach the second tile. Even if I clear the workspace and re-run the data processing from scratch, subsequent re-runs will fail for the first tile unless I restart the program. How can I increase the line weight of the boxplots (particularly the whiskers) without running into this problem? Thanks!I have written some code to produce 2 boxplots side by side using tiledlayout. I would like to increase the line weight of the boxes and the whiskers and have written the code to do so as follows:
figure()
t = tiledlayout(1,2,’tilespacing’,’none’);
nexttile
boxplot(T_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx1 = findobj(‘Tag’,’boxplot’);
set(bx1.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
nexttile
boxplot(S_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx2 = findobj(‘Tag’,’boxplot’);
set(bx2.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
The first time I run this code, the first tile runs successfully and I get the following error message for the second tile:
Error using matlab.graphics.primitive.Line/set
Invalid parameter/value pair arguments.
Error in Filename (line XXX)
set(bx2.Children,’LineWidth’,2)
If I then do nothing, just hit enter again to re-run the cell, it then fails with the same error, but now for the first tile – and does not reach the second tile. Even if I clear the workspace and re-run the data processing from scratch, subsequent re-runs will fail for the first tile unless I restart the program. How can I increase the line weight of the boxplots (particularly the whiskers) without running into this problem? Thanks! I have written some code to produce 2 boxplots side by side using tiledlayout. I would like to increase the line weight of the boxes and the whiskers and have written the code to do so as follows:
figure()
t = tiledlayout(1,2,’tilespacing’,’none’);
nexttile
boxplot(T_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx1 = findobj(‘Tag’,’boxplot’);
set(bx1.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
nexttile
boxplot(S_toPlot,’BoxStyle’,’outline’,’Color’, ‘b’, ‘Symbol’,’xk’, ‘OutlierSize’,8,’Labels’, labels);
bx2 = findobj(‘Tag’,’boxplot’);
set(bx2.Children,’LineWidth’,2)
h = findobj(gca,’Tag’,’Box’);
for j=1:length(h)
patch(get(h(j),’XData’),get(h(j),’YData’),get(h(j),’Color’),’FaceAlpha’,.5);
end
clear h j
The first time I run this code, the first tile runs successfully and I get the following error message for the second tile:
Error using matlab.graphics.primitive.Line/set
Invalid parameter/value pair arguments.
Error in Filename (line XXX)
set(bx2.Children,’LineWidth’,2)
If I then do nothing, just hit enter again to re-run the cell, it then fails with the same error, but now for the first tile – and does not reach the second tile. Even if I clear the workspace and re-run the data processing from scratch, subsequent re-runs will fail for the first tile unless I restart the program. How can I increase the line weight of the boxplots (particularly the whiskers) without running into this problem? Thanks! boxplot, matlab MATLAB Answers — New Questions
what is power spectrum value mean (‘pspectrum’)
I used the following code.
This is a code that perform STFT on time series pressure data.
[p, f, t] = pspectrum(Pascal, sample_rate, ‘TimeResolution’, 1, ‘spectrogram’);
The MATLAB hompage explanation says the output(‘p’) represents the power spectrum value.
I want to ask what is a power spectrum value’s physical meaning, How is it related to my input, ‘Pascal’ ?
Thank you.I used the following code.
This is a code that perform STFT on time series pressure data.
[p, f, t] = pspectrum(Pascal, sample_rate, ‘TimeResolution’, 1, ‘spectrogram’);
The MATLAB hompage explanation says the output(‘p’) represents the power spectrum value.
I want to ask what is a power spectrum value’s physical meaning, How is it related to my input, ‘Pascal’ ?
Thank you. I used the following code.
This is a code that perform STFT on time series pressure data.
[p, f, t] = pspectrum(Pascal, sample_rate, ‘TimeResolution’, 1, ‘spectrogram’);
The MATLAB hompage explanation says the output(‘p’) represents the power spectrum value.
I want to ask what is a power spectrum value’s physical meaning, How is it related to my input, ‘Pascal’ ?
Thank you. fft, stft, noise, signal MATLAB Answers — New Questions
Error using assignin in a nested m function
Error using assignin
Attempt to add "q" to a static workspace.
Error in syms (line 283)
assignin(‘caller’, x, xsym);
Error in mywork/myfunction (line 66)
syms a(t) q
This error occurs when running mywork.m but not myfunction alone.Error using assignin
Attempt to add "q" to a static workspace.
Error in syms (line 283)
assignin(‘caller’, x, xsym);
Error in mywork/myfunction (line 66)
syms a(t) q
This error occurs when running mywork.m but not myfunction alone. Error using assignin
Attempt to add "q" to a static workspace.
Error in syms (line 283)
assignin(‘caller’, x, xsym);
Error in mywork/myfunction (line 66)
syms a(t) q
This error occurs when running mywork.m but not myfunction alone. syms MATLAB Answers — New Questions
Managing large number of large set of parameter
Hello All,
Do you have some tips for managing a lot of design data. I give you my usecase, maybe you can share yours to improve way to manage data under our models.
My simulink models are component-based with many subsystems reference, each subsystem reference are a variant model of several subsystem reference.
each component of my composition can be instancited many times with different parameters.
I build a kind of framework with mask to path different parameters for each instance.
My paramters are manage like that :
CmpObj.Param.MyParam.v
I’ve got as many m-files as instance of my component. So I have a lot of m-files splitted into many folder which is a nightmare.
What do you think ? How did you do ?Hello All,
Do you have some tips for managing a lot of design data. I give you my usecase, maybe you can share yours to improve way to manage data under our models.
My simulink models are component-based with many subsystems reference, each subsystem reference are a variant model of several subsystem reference.
each component of my composition can be instancited many times with different parameters.
I build a kind of framework with mask to path different parameters for each instance.
My paramters are manage like that :
CmpObj.Param.MyParam.v
I’ve got as many m-files as instance of my component. So I have a lot of m-files splitted into many folder which is a nightmare.
What do you think ? How did you do ? Hello All,
Do you have some tips for managing a lot of design data. I give you my usecase, maybe you can share yours to improve way to manage data under our models.
My simulink models are component-based with many subsystems reference, each subsystem reference are a variant model of several subsystem reference.
each component of my composition can be instancited many times with different parameters.
I build a kind of framework with mask to path different parameters for each instance.
My paramters are manage like that :
CmpObj.Param.MyParam.v
I’ve got as many m-files as instance of my component. So I have a lot of m-files splitted into many folder which is a nightmare.
What do you think ? How did you do ? simulink MATLAB Answers — New Questions
pcolor plot: how to scale the smoothing differently in x and y directions
I have data of say this type (this is a simplified example):
A = [0 0 0 0 0 0
0 0 2 0 0 0
0 0 9 0 0 0
0 0 1 1 0 0
0 0 0 8 0 0
0 0 0 1 0 0
0 0 0 0 0 0];
If I do:
figure; pcolor(A); shading interp
then I get two distinct "peaks":
Now the thing is that I know from the property of the data (two-dimensional gas chromatography) that it is actually the same peak, it is normal that in each column the peak is moving by some pixels downward (in my simplified example here it is moving by two pixels, in the actual data it is even more). I would like to tell pcolor that distance in the x and y direction does not count the same (a sort of weighting maybe?), so that pcolor instead understands that these are one and the same "peak" and plot that as a single "peak". (This must also be directional: if the peak "goes down" in the next column (by approximately the right extent), then it should be considered the same peak. Essentially, instead of considering x and y distances, I want somehow to consider the distance at an angle)… Is there an option to do that easily?I have data of say this type (this is a simplified example):
A = [0 0 0 0 0 0
0 0 2 0 0 0
0 0 9 0 0 0
0 0 1 1 0 0
0 0 0 8 0 0
0 0 0 1 0 0
0 0 0 0 0 0];
If I do:
figure; pcolor(A); shading interp
then I get two distinct "peaks":
Now the thing is that I know from the property of the data (two-dimensional gas chromatography) that it is actually the same peak, it is normal that in each column the peak is moving by some pixels downward (in my simplified example here it is moving by two pixels, in the actual data it is even more). I would like to tell pcolor that distance in the x and y direction does not count the same (a sort of weighting maybe?), so that pcolor instead understands that these are one and the same "peak" and plot that as a single "peak". (This must also be directional: if the peak "goes down" in the next column (by approximately the right extent), then it should be considered the same peak. Essentially, instead of considering x and y distances, I want somehow to consider the distance at an angle)… Is there an option to do that easily? I have data of say this type (this is a simplified example):
A = [0 0 0 0 0 0
0 0 2 0 0 0
0 0 9 0 0 0
0 0 1 1 0 0
0 0 0 8 0 0
0 0 0 1 0 0
0 0 0 0 0 0];
If I do:
figure; pcolor(A); shading interp
then I get two distinct "peaks":
Now the thing is that I know from the property of the data (two-dimensional gas chromatography) that it is actually the same peak, it is normal that in each column the peak is moving by some pixels downward (in my simplified example here it is moving by two pixels, in the actual data it is even more). I would like to tell pcolor that distance in the x and y direction does not count the same (a sort of weighting maybe?), so that pcolor instead understands that these are one and the same "peak" and plot that as a single "peak". (This must also be directional: if the peak "goes down" in the next column (by approximately the right extent), then it should be considered the same peak. Essentially, instead of considering x and y distances, I want somehow to consider the distance at an angle)… Is there an option to do that easily? pcolor x-y distortion MATLAB Answers — New Questions
How to couple Simscape Thermal Liquid/Thermal models with an Electrical Subsystem in Simulink?
Hi, I am building a closed-loop heating system powered electically in Simulink with Simscape using:
Yellow blocks: Thermal Liquid (pipes, tank, valves)
Orange blocks: Thermal domain (to model heat losses, etc.)
Electrical subsystem: done in Simulink ( black blocks)
I am making the main "components" of the heating system: E-boiler, Heat Pump, Water Tank and heating demand, made of the different types of components mentioned above. The water gets heated at the heat pump and e-boiler, gets stored in the water tank and then goes to the heating demand.
I’m stuck on how to connect the electrical part to the thermal/thermal-liquid part. For example, the e-boiler in the thermal-liquid loop is being electrical powered then it heats the water that then flows though the whole heating system. Is this possible?
I was also considering for a while to remake the electrical part with Simscape electrical, thinking it would be easier to connect. Is that the case?
I tried looking for components that can do this directly, but couldn’t find any.
My experience with MATLAB/Simulink is mostly from school projects, so I’m sure I’m missing a lot of things.
Any tips or advice would be very helpful. Thank you!Hi, I am building a closed-loop heating system powered electically in Simulink with Simscape using:
Yellow blocks: Thermal Liquid (pipes, tank, valves)
Orange blocks: Thermal domain (to model heat losses, etc.)
Electrical subsystem: done in Simulink ( black blocks)
I am making the main "components" of the heating system: E-boiler, Heat Pump, Water Tank and heating demand, made of the different types of components mentioned above. The water gets heated at the heat pump and e-boiler, gets stored in the water tank and then goes to the heating demand.
I’m stuck on how to connect the electrical part to the thermal/thermal-liquid part. For example, the e-boiler in the thermal-liquid loop is being electrical powered then it heats the water that then flows though the whole heating system. Is this possible?
I was also considering for a while to remake the electrical part with Simscape electrical, thinking it would be easier to connect. Is that the case?
I tried looking for components that can do this directly, but couldn’t find any.
My experience with MATLAB/Simulink is mostly from school projects, so I’m sure I’m missing a lot of things.
Any tips or advice would be very helpful. Thank you! Hi, I am building a closed-loop heating system powered electically in Simulink with Simscape using:
Yellow blocks: Thermal Liquid (pipes, tank, valves)
Orange blocks: Thermal domain (to model heat losses, etc.)
Electrical subsystem: done in Simulink ( black blocks)
I am making the main "components" of the heating system: E-boiler, Heat Pump, Water Tank and heating demand, made of the different types of components mentioned above. The water gets heated at the heat pump and e-boiler, gets stored in the water tank and then goes to the heating demand.
I’m stuck on how to connect the electrical part to the thermal/thermal-liquid part. For example, the e-boiler in the thermal-liquid loop is being electrical powered then it heats the water that then flows though the whole heating system. Is this possible?
I was also considering for a while to remake the electrical part with Simscape electrical, thinking it would be easier to connect. Is that the case?
I tried looking for components that can do this directly, but couldn’t find any.
My experience with MATLAB/Simulink is mostly from school projects, so I’m sure I’m missing a lot of things.
Any tips or advice would be very helpful. Thank you! simscape, thermal-liquid MATLAB Answers — New Questions
Receiver Position Not Updated in Radar Example?
I am working through this example on passively sensing radar:
https://www.mathworks.com/help/phased/ug/signal-parameter-estimations-in-a-radar-warning-receiver.html
But I’m confused about how the txPulseTrain is received by the collector. It appears that they are injested by the collector at a single angle, rather than at changing angles over time:
[~, tgtAng] = rangeangle(radarPos,rwrPos);
yr = collector(txPulseTrain,tgtAng);
This may be an okay approximation, but it seems like a more accurate approach is to model the receiver at each timestep, in the loop within helperRWR.simulateTransmission.
Also, in the above code, the rwrPos variable above is equal to its original value when the pulses were emitted, not when they were collected, which seems like an oversight?
Please let me know if I’m missing something with both of these issues. Thank you for putting together the example!I am working through this example on passively sensing radar:
https://www.mathworks.com/help/phased/ug/signal-parameter-estimations-in-a-radar-warning-receiver.html
But I’m confused about how the txPulseTrain is received by the collector. It appears that they are injested by the collector at a single angle, rather than at changing angles over time:
[~, tgtAng] = rangeangle(radarPos,rwrPos);
yr = collector(txPulseTrain,tgtAng);
This may be an okay approximation, but it seems like a more accurate approach is to model the receiver at each timestep, in the loop within helperRWR.simulateTransmission.
Also, in the above code, the rwrPos variable above is equal to its original value when the pulses were emitted, not when they were collected, which seems like an oversight?
Please let me know if I’m missing something with both of these issues. Thank you for putting together the example! I am working through this example on passively sensing radar:
https://www.mathworks.com/help/phased/ug/signal-parameter-estimations-in-a-radar-warning-receiver.html
But I’m confused about how the txPulseTrain is received by the collector. It appears that they are injested by the collector at a single angle, rather than at changing angles over time:
[~, tgtAng] = rangeangle(radarPos,rwrPos);
yr = collector(txPulseTrain,tgtAng);
This may be an okay approximation, but it seems like a more accurate approach is to model the receiver at each timestep, in the loop within helperRWR.simulateTransmission.
Also, in the above code, the rwrPos variable above is equal to its original value when the pulses were emitted, not when they were collected, which seems like an oversight?
Please let me know if I’m missing something with both of these issues. Thank you for putting together the example! pulse MATLAB Answers — New Questions
Create Figure Without Displaying it
Hi,
I’d like to create a figure and save it in the background without displaying it.
I’ve heard of setting the "visibility" setting to "off", but the figure window still pops up.
I’d rather just have the figure be created and saved in its specified folder without having to see it.
Any way to do this?
Thanks,
JFHi,
I’d like to create a figure and save it in the background without displaying it.
I’ve heard of setting the "visibility" setting to "off", but the figure window still pops up.
I’d rather just have the figure be created and saved in its specified folder without having to see it.
Any way to do this?
Thanks,
JF Hi,
I’d like to create a figure and save it in the background without displaying it.
I’ve heard of setting the "visibility" setting to "off", but the figure window still pops up.
I’d rather just have the figure be created and saved in its specified folder without having to see it.
Any way to do this?
Thanks,
JF figure, visible, visibility, background, image, create MATLAB Answers — New Questions
The Simulation is link is not working
I am trying to run this simulation
https://uk.mathworks.com/help/sps/ug/24-hour-simulation-of-a-vehicle-to-grid-v2g-system.html
But it is giving me ythe following errors:
openExample(‘simscapeelectricalsps/VehicletoGridSystemExample’)
Error using websave (line 107)
The server returned the status 404 with message "Not Found" in response to the request to URL
https://www.mathworks.com/help/releases/R2025b/exampledata/simscapeelectricalsps/examples.xml.
Error in
matlab.internal.examples.copyFromWeb (line 28)
result = websave(target, url, options);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
matlab.internal.examples.findExamplesXml (line 32)
found = matlab.internal.examples.copyFromWeb(component, ”, ‘examples.xml’, examplesXml, false);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
findExample (line 14)
examplesXml = matlab.internal.examples.findExamplesXml(component,arg);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
openExample (line 42)
metadata = findExample(exampleId);
Any leads?I am trying to run this simulation
https://uk.mathworks.com/help/sps/ug/24-hour-simulation-of-a-vehicle-to-grid-v2g-system.html
But it is giving me ythe following errors:
openExample(‘simscapeelectricalsps/VehicletoGridSystemExample’)
Error using websave (line 107)
The server returned the status 404 with message "Not Found" in response to the request to URL
https://www.mathworks.com/help/releases/R2025b/exampledata/simscapeelectricalsps/examples.xml.
Error in
matlab.internal.examples.copyFromWeb (line 28)
result = websave(target, url, options);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
matlab.internal.examples.findExamplesXml (line 32)
found = matlab.internal.examples.copyFromWeb(component, ”, ‘examples.xml’, examplesXml, false);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
findExample (line 14)
examplesXml = matlab.internal.examples.findExamplesXml(component,arg);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
openExample (line 42)
metadata = findExample(exampleId);
Any leads? I am trying to run this simulation
https://uk.mathworks.com/help/sps/ug/24-hour-simulation-of-a-vehicle-to-grid-v2g-system.html
But it is giving me ythe following errors:
openExample(‘simscapeelectricalsps/VehicletoGridSystemExample’)
Error using websave (line 107)
The server returned the status 404 with message "Not Found" in response to the request to URL
https://www.mathworks.com/help/releases/R2025b/exampledata/simscapeelectricalsps/examples.xml.
Error in
matlab.internal.examples.copyFromWeb (line 28)
result = websave(target, url, options);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
matlab.internal.examples.findExamplesXml (line 32)
found = matlab.internal.examples.copyFromWeb(component, ”, ‘examples.xml’, examplesXml, false);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
findExample (line 14)
examplesXml = matlab.internal.examples.findExamplesXml(component,arg);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in
openExample (line 42)
metadata = findExample(exampleId);
Any leads? v2g MATLAB Answers — New Questions
I keep getting the same error when using readtable or readmatrix: Dimensions of arrays being concatenated are not consistent.
A = readtable(‘data_file.csv’)
A = readmatrix(‘data_file.csv’)
When I tell you I have tried everything. Uninstalled and reinstalled Matlab twice. Cleared my cache of all matlab knowledge. I cannot read in data from a csv or text file using readtable and readmatrix for the life of me. Somebody please help. I have tried doing the same exact things on other’s computers and it works perfectly. I am convinced my readtable and readmatrix functions are broken.A = readtable(‘data_file.csv’)
A = readmatrix(‘data_file.csv’)
When I tell you I have tried everything. Uninstalled and reinstalled Matlab twice. Cleared my cache of all matlab knowledge. I cannot read in data from a csv or text file using readtable and readmatrix for the life of me. Somebody please help. I have tried doing the same exact things on other’s computers and it works perfectly. I am convinced my readtable and readmatrix functions are broken. A = readtable(‘data_file.csv’)
A = readmatrix(‘data_file.csv’)
When I tell you I have tried everything. Uninstalled and reinstalled Matlab twice. Cleared my cache of all matlab knowledge. I cannot read in data from a csv or text file using readtable and readmatrix for the life of me. Somebody please help. I have tried doing the same exact things on other’s computers and it works perfectly. I am convinced my readtable and readmatrix functions are broken. readtable, readmatrix MATLAB Answers — New Questions
Script doesn’t show
I was working on an assignment on MATLAB and wrote a function script in the editor and saved it as .m file. The next day I open the file and the script was gone. This is the second time it has happened. How do I recover the script?I was working on an assignment on MATLAB and wrote a function script in the editor and saved it as .m file. The next day I open the file and the script was gone. This is the second time it has happened. How do I recover the script? I was working on an assignment on MATLAB and wrote a function script in the editor and saved it as .m file. The next day I open the file and the script was gone. This is the second time it has happened. How do I recover the script? script, editor, deleted MATLAB Answers — New Questions
How can I syncronize two PWM on STM32 using the Embedded Coder Support Package
I need to generate two PWM signals with variable Duty cycle controlled by reading from two ADC, and that is simple. The problem is that I need to introduce a fixed phase difference between the two signals. I tryed using triggered subsystems, but it does not seem to work. The two PWM are on two different timers, should I use two different channels of the same timer ? Should I use a third timer in a master slave configuration ?I need to generate two PWM signals with variable Duty cycle controlled by reading from two ADC, and that is simple. The problem is that I need to introduce a fixed phase difference between the two signals. I tryed using triggered subsystems, but it does not seem to work. The two PWM are on two different timers, should I use two different channels of the same timer ? Should I use a third timer in a master slave configuration ? I need to generate two PWM signals with variable Duty cycle controlled by reading from two ADC, and that is simple. The problem is that I need to introduce a fixed phase difference between the two signals. I tryed using triggered subsystems, but it does not seem to work. The two PWM are on two different timers, should I use two different channels of the same timer ? Should I use a third timer in a master slave configuration ? stm32, pwm, synchronization MATLAB Answers — New Questions
In R2025a, how to add Additional Fonts?
Before R2025a, we can install the font in the jrelibfonts folder where Java® software is installed on your system, for example, C:Program FilesMATLABR2024asysjavajrewin64jrelibfonts. Then, use the font in MATLAB by selecting it in the MATLAB > Fonts settings.
But in R2025a, how to add Additional Fonts. Because it seems that the aforementioned method has become ineffective.Before R2025a, we can install the font in the jrelibfonts folder where Java® software is installed on your system, for example, C:Program FilesMATLABR2024asysjavajrewin64jrelibfonts. Then, use the font in MATLAB by selecting it in the MATLAB > Fonts settings.
But in R2025a, how to add Additional Fonts. Because it seems that the aforementioned method has become ineffective. Before R2025a, we can install the font in the jrelibfonts folder where Java® software is installed on your system, for example, C:Program FilesMATLABR2024asysjavajrewin64jrelibfonts. Then, use the font in MATLAB by selecting it in the MATLAB > Fonts settings.
But in R2025a, how to add Additional Fonts. Because it seems that the aforementioned method has become ineffective. font, code MATLAB Answers — New Questions
Add folder and subfolder to project path
Hi everyone,
I’m trying to use the addPath function to add multiple folders to a MATLAB project’s path. According to the documentation, the folders input argument should be:
"Path of the folders to add to the project path, specified as string array or as a cell array of character vectors. The folders must be within the root folder."
Here’s a minimal example of what I tried:
tmp = ["Hello", "HelloWorld"];
addPath(proj, tmp);
but I got this error:
Error using matlab.internal.project.japi.Project/addPath
Expected file to be of size 1×1, but it is of size 2×1.
Error in matlab.project.Project/addPath
Even though tmp is a string array, MATLAB seems to expect only a single path.
For context:
The folders already exist within the project
I’ve added them (and their subfolders/files) using addFolderIncludingChildFiles, but that function doesn’t add the folders to the project path
I’m using MATLAB R2024b
I’m trying to use addPath with multiple folders at once because adding each folder path in a for loop is very time-consuming when dealing with many subdirectories.
Has anyone managed to add multiple folders at once using addPath, or is it necessary to call it one folder at a time?
Any suggestions or workarounds would be greatly appreciated!
Thanks in advance!Hi everyone,
I’m trying to use the addPath function to add multiple folders to a MATLAB project’s path. According to the documentation, the folders input argument should be:
"Path of the folders to add to the project path, specified as string array or as a cell array of character vectors. The folders must be within the root folder."
Here’s a minimal example of what I tried:
tmp = ["Hello", "HelloWorld"];
addPath(proj, tmp);
but I got this error:
Error using matlab.internal.project.japi.Project/addPath
Expected file to be of size 1×1, but it is of size 2×1.
Error in matlab.project.Project/addPath
Even though tmp is a string array, MATLAB seems to expect only a single path.
For context:
The folders already exist within the project
I’ve added them (and their subfolders/files) using addFolderIncludingChildFiles, but that function doesn’t add the folders to the project path
I’m using MATLAB R2024b
I’m trying to use addPath with multiple folders at once because adding each folder path in a for loop is very time-consuming when dealing with many subdirectories.
Has anyone managed to add multiple folders at once using addPath, or is it necessary to call it one folder at a time?
Any suggestions or workarounds would be greatly appreciated!
Thanks in advance! Hi everyone,
I’m trying to use the addPath function to add multiple folders to a MATLAB project’s path. According to the documentation, the folders input argument should be:
"Path of the folders to add to the project path, specified as string array or as a cell array of character vectors. The folders must be within the root folder."
Here’s a minimal example of what I tried:
tmp = ["Hello", "HelloWorld"];
addPath(proj, tmp);
but I got this error:
Error using matlab.internal.project.japi.Project/addPath
Expected file to be of size 1×1, but it is of size 2×1.
Error in matlab.project.Project/addPath
Even though tmp is a string array, MATLAB seems to expect only a single path.
For context:
The folders already exist within the project
I’ve added them (and their subfolders/files) using addFolderIncludingChildFiles, but that function doesn’t add the folders to the project path
I’m using MATLAB R2024b
I’m trying to use addPath with multiple folders at once because adding each folder path in a for loop is very time-consuming when dealing with many subdirectories.
Has anyone managed to add multiple folders at once using addPath, or is it necessary to call it one folder at a time?
Any suggestions or workarounds would be greatly appreciated!
Thanks in advance! matlab, iteration, vectorization, optimization MATLAB Answers — New Questions
Indexing in a matrix vs vector
Why can we write A(1,2) for a nx2 matrix, with n>1, and we cannot write i=1; x(i,2) for a vector x = [x1 x2]?
It only accepts x(i+1), but I need to iterate the index i over the rows and not the columns, for any nx2 matrix with n>=1.
Thank you in advance.Why can we write A(1,2) for a nx2 matrix, with n>1, and we cannot write i=1; x(i,2) for a vector x = [x1 x2]?
It only accepts x(i+1), but I need to iterate the index i over the rows and not the columns, for any nx2 matrix with n>=1.
Thank you in advance. Why can we write A(1,2) for a nx2 matrix, with n>1, and we cannot write i=1; x(i,2) for a vector x = [x1 x2]?
It only accepts x(i+1), but I need to iterate the index i over the rows and not the columns, for any nx2 matrix with n>=1.
Thank you in advance. indexing, vector, matrix MATLAB Answers — New Questions
mairplot throws uimenu error
Dear all,
I have been following the rnaseq demo (https://www.mathworks.com/help/bioinfo/ug/identifying-differentially-expressed-genes-from-rna-seq-data.html) to build out a livescript to analyze some differential gene expression data. However, I’m having issues with generating an interactive MA plot using mairplot.
I used a larger version of the attached input data file (data_head.txt) to populate a table (data). I then issued mairplot as follows:
mairplot(data.meanTreated,data.meanUntreated,’Labels’,data.sgRNA_ID,’Type’,’MA’);
However, I get the following error:
Error using uimenu
First argument must be a valid parent, such as a Figure or Panel object.
Error in mairplot>resetFigureTools (line 345)
uimenu(hw,’Label’,’Export to Workspace…’,’Position’,1, ‘Callback’, @exportDiffResults);
Error in mairplot (line 168)
resetFigureTools(hFig);
I did convert the data.sgRNA_ID table variable from a cell array to strings using
data.sgRNA_ID = string(data.sgRNA_ID)
, but got the same error.
I was able to run the example code (rnaseqdemo.m; attached), including the interactive MA plot.
I was also able to successfully create an MA plot with the following command:
mairplot(data.meanTreated,data.meanUntreated,’Type’,’MA’,’Plotonly’,true);
Thank you for your help! Let me know if you need more info to help me troubleshoot this.
Best,
KartikDear all,
I have been following the rnaseq demo (https://www.mathworks.com/help/bioinfo/ug/identifying-differentially-expressed-genes-from-rna-seq-data.html) to build out a livescript to analyze some differential gene expression data. However, I’m having issues with generating an interactive MA plot using mairplot.
I used a larger version of the attached input data file (data_head.txt) to populate a table (data). I then issued mairplot as follows:
mairplot(data.meanTreated,data.meanUntreated,’Labels’,data.sgRNA_ID,’Type’,’MA’);
However, I get the following error:
Error using uimenu
First argument must be a valid parent, such as a Figure or Panel object.
Error in mairplot>resetFigureTools (line 345)
uimenu(hw,’Label’,’Export to Workspace…’,’Position’,1, ‘Callback’, @exportDiffResults);
Error in mairplot (line 168)
resetFigureTools(hFig);
I did convert the data.sgRNA_ID table variable from a cell array to strings using
data.sgRNA_ID = string(data.sgRNA_ID)
, but got the same error.
I was able to run the example code (rnaseqdemo.m; attached), including the interactive MA plot.
I was also able to successfully create an MA plot with the following command:
mairplot(data.meanTreated,data.meanUntreated,’Type’,’MA’,’Plotonly’,true);
Thank you for your help! Let me know if you need more info to help me troubleshoot this.
Best,
Kartik Dear all,
I have been following the rnaseq demo (https://www.mathworks.com/help/bioinfo/ug/identifying-differentially-expressed-genes-from-rna-seq-data.html) to build out a livescript to analyze some differential gene expression data. However, I’m having issues with generating an interactive MA plot using mairplot.
I used a larger version of the attached input data file (data_head.txt) to populate a table (data). I then issued mairplot as follows:
mairplot(data.meanTreated,data.meanUntreated,’Labels’,data.sgRNA_ID,’Type’,’MA’);
However, I get the following error:
Error using uimenu
First argument must be a valid parent, such as a Figure or Panel object.
Error in mairplot>resetFigureTools (line 345)
uimenu(hw,’Label’,’Export to Workspace…’,’Position’,1, ‘Callback’, @exportDiffResults);
Error in mairplot (line 168)
resetFigureTools(hFig);
I did convert the data.sgRNA_ID table variable from a cell array to strings using
data.sgRNA_ID = string(data.sgRNA_ID)
, but got the same error.
I was able to run the example code (rnaseqdemo.m; attached), including the interactive MA plot.
I was also able to successfully create an MA plot with the following command:
mairplot(data.meanTreated,data.meanUntreated,’Type’,’MA’,’Plotonly’,true);
Thank you for your help! Let me know if you need more info to help me troubleshoot this.
Best,
Kartik bioinformatics toolbox, mairplot MATLAB Answers — New Questions
When using the function pseudoranges, why does the mean value of the time delay vary from satellite to satellite for the same receiver?
I am simulating a single receiver receiving signals from different satellites. The single receiver has one single value for clock bias, which should show up when using the function pseudoranges as a constant mean time delay. (In addition to clock bias, there are random components; I expect there to be a variance, but I expect the mean of the time delay values to be more or less constant from satellite to satellite.) In practice, when I apply pseudoranges to different satellites sending signals to the same receiver, the mean time delay varies from satellite to satellite.
Is this the correct behavior of the function pseudoranges? What other effects are incorporated into pseudoranges that may be causing this?I am simulating a single receiver receiving signals from different satellites. The single receiver has one single value for clock bias, which should show up when using the function pseudoranges as a constant mean time delay. (In addition to clock bias, there are random components; I expect there to be a variance, but I expect the mean of the time delay values to be more or less constant from satellite to satellite.) In practice, when I apply pseudoranges to different satellites sending signals to the same receiver, the mean time delay varies from satellite to satellite.
Is this the correct behavior of the function pseudoranges? What other effects are incorporated into pseudoranges that may be causing this? I am simulating a single receiver receiving signals from different satellites. The single receiver has one single value for clock bias, which should show up when using the function pseudoranges as a constant mean time delay. (In addition to clock bias, there are random components; I expect there to be a variance, but I expect the mean of the time delay values to be more or less constant from satellite to satellite.) In practice, when I apply pseudoranges to different satellites sending signals to the same receiver, the mean time delay varies from satellite to satellite.
Is this the correct behavior of the function pseudoranges? What other effects are incorporated into pseudoranges that may be causing this? pseudoranges, satellite MATLAB Answers — New Questions
field name to string
I have read this article: https://de.mathworks.com/help/matlab/ref/inputname.html where it is stated that dot indexing aka struct fields are not supported by the function inputname which makes this function for my usecase basically worthless. Arte there any other options to hand over a struct member and get the full name (aka a.b)?I have read this article: https://de.mathworks.com/help/matlab/ref/inputname.html where it is stated that dot indexing aka struct fields are not supported by the function inputname which makes this function for my usecase basically worthless. Arte there any other options to hand over a struct member and get the full name (aka a.b)? I have read this article: https://de.mathworks.com/help/matlab/ref/inputname.html where it is stated that dot indexing aka struct fields are not supported by the function inputname which makes this function for my usecase basically worthless. Arte there any other options to hand over a struct member and get the full name (aka a.b)? inputname MATLAB Answers — New Questions
MatLab App versus MatLab Compiler Runtime version requirements
Greetings,
Can someone please advise if MatLab 2023b requires MatLab Runtime 2023b or will MatLab Runtime 2023a work? We have MatLab 2023b and Compiler Runtime 2023a, will this work together?
If MatLab and Runtime require specific versions is there an Archive or somewhere either Runtime 2023b or MatLab 2023a can be downloaded?
Appreciate the clarification and assistance.Greetings,
Can someone please advise if MatLab 2023b requires MatLab Runtime 2023b or will MatLab Runtime 2023a work? We have MatLab 2023b and Compiler Runtime 2023a, will this work together?
If MatLab and Runtime require specific versions is there an Archive or somewhere either Runtime 2023b or MatLab 2023a can be downloaded?
Appreciate the clarification and assistance. Greetings,
Can someone please advise if MatLab 2023b requires MatLab Runtime 2023b or will MatLab Runtime 2023a work? We have MatLab 2023b and Compiler Runtime 2023a, will this work together?
If MatLab and Runtime require specific versions is there an Archive or somewhere either Runtime 2023b or MatLab 2023a can be downloaded?
Appreciate the clarification and assistance. matlab compiler runtime versions MATLAB Answers — New Questions









