Author: PuTI
how to adjust the time axis in Simulink scope
Hi all,
I have adjust the maxium time axis is 20s but the simulation stop until 10s as shown in the attached picture. Please help, thank youHi all,
I have adjust the maxium time axis is 20s but the simulation stop until 10s as shown in the attached picture. Please help, thank you Hi all,
I have adjust the maxium time axis is 20s but the simulation stop until 10s as shown in the attached picture. Please help, thank you time axis of scope simulink MATLAB Answers — New Questions
Audioread Bug with Opus (maximum value returned exceeding 1)
Hello,
I think there is a bug with the audioread function and opus files. Somehow, I am getting maximum values read > 1. The files are perfectly fine and from a well mastered cd and opus files were made with ffmpeg from it. I have tried running this code in matlab 2023b and 2025a pre release, issue is persisting. Please help.
Output:
————————————————–
File: C:UsersAdminDesktopDatasetsCompressorinput.wav
Max Value: 0.98535 0.98593
Filename: ‘C:UsersAdminDesktopDatasetsCompressorinput.wav’
CompressionMethod: ‘Uncompressed’
NumChannels: 2
SampleRate: 44100
TotalSamples: 166800900
Duration: 3.7823e+03
Title: []
Comment: []
Artist: []
BitsPerSample: 16
————————————————–
————————————————–
"File: " "C:UsersAdminDesktopDatasetsCompressorMP3_EncodesC…"
Max Value: 1 1
Filename: ‘C:UsersAdminDesktopDatasetsCompressorMP3_EncodesCBRCBR_128_MP3.mp3’
CompressionMethod: ‘MP3’
NumChannels: 2
SampleRate: 44100
TotalSamples: 166803837
Duration: 3.7824e+03
Title: []
Comment: []
Artist: []
BitRate: 128
————————————————–
————————————————–
File: C:UsersAdminDesktopDatasetsCompressorOpus_PresetsCBRCBR_128_Opus.opus
Max Value: 1.3834 1.4113
Filename: ‘C:UsersAdminDesktopDatasetsCompressorOpus_PresetsCBRCBR_128_Opus.opus’
CompressionMethod: ‘Opus’
NumChannels: 2
SampleRate: 48000
TotalSamples: 181552000
Duration: 3.7823e+03
Title: []
Comment: []
Artist: []
————————————————–
Code to reproduce bug:
% Define the list of input files (add more file paths as needed)
inputFiles = {
‘C:UsersAdminDesktopDatasetsCompressorinput.wav’, %original wav file
"C:UsersAdminDesktopDatasetsCompressorMP3_EncodesCBRCBR_128_MP3.mp3",
‘C:UsersAdminDesktopDatasetsCompressorOpus_PresetsCBRCBR_128_Opus.opus’
};
% Loop through each input file
for i = 1:length(inputFiles)
% Get the current input file path
inputFile = inputFiles{i};
% Read the audio file
[audioIn, inputFs] = audioread(inputFile);
% Find the maximum absolute value in the audio data
maxValue = max(abs(audioIn));
% Display the result for each file in a more readable format using disp
disp(‘————————————————–‘);
disp([‘File: ‘, inputFile]);
disp([‘Max Value: ‘, num2str(maxValue)]);
info = audioinfo(inputFile);
disp(info);
disp(‘————————————————–‘);
end
EDIT:
The plot thickens, as a factor of sqrt(2) appears before the weights in the opus with all files I tested vs the mp3 and wav weights.Hello,
I think there is a bug with the audioread function and opus files. Somehow, I am getting maximum values read > 1. The files are perfectly fine and from a well mastered cd and opus files were made with ffmpeg from it. I have tried running this code in matlab 2023b and 2025a pre release, issue is persisting. Please help.
Output:
————————————————–
File: C:UsersAdminDesktopDatasetsCompressorinput.wav
Max Value: 0.98535 0.98593
Filename: ‘C:UsersAdminDesktopDatasetsCompressorinput.wav’
CompressionMethod: ‘Uncompressed’
NumChannels: 2
SampleRate: 44100
TotalSamples: 166800900
Duration: 3.7823e+03
Title: []
Comment: []
Artist: []
BitsPerSample: 16
————————————————–
————————————————–
"File: " "C:UsersAdminDesktopDatasetsCompressorMP3_EncodesC…"
Max Value: 1 1
Filename: ‘C:UsersAdminDesktopDatasetsCompressorMP3_EncodesCBRCBR_128_MP3.mp3’
CompressionMethod: ‘MP3’
NumChannels: 2
SampleRate: 44100
TotalSamples: 166803837
Duration: 3.7824e+03
Title: []
Comment: []
Artist: []
BitRate: 128
————————————————–
————————————————–
File: C:UsersAdminDesktopDatasetsCompressorOpus_PresetsCBRCBR_128_Opus.opus
Max Value: 1.3834 1.4113
Filename: ‘C:UsersAdminDesktopDatasetsCompressorOpus_PresetsCBRCBR_128_Opus.opus’
CompressionMethod: ‘Opus’
NumChannels: 2
SampleRate: 48000
TotalSamples: 181552000
Duration: 3.7823e+03
Title: []
Comment: []
Artist: []
————————————————–
Code to reproduce bug:
% Define the list of input files (add more file paths as needed)
inputFiles = {
‘C:UsersAdminDesktopDatasetsCompressorinput.wav’, %original wav file
"C:UsersAdminDesktopDatasetsCompressorMP3_EncodesCBRCBR_128_MP3.mp3",
‘C:UsersAdminDesktopDatasetsCompressorOpus_PresetsCBRCBR_128_Opus.opus’
};
% Loop through each input file
for i = 1:length(inputFiles)
% Get the current input file path
inputFile = inputFiles{i};
% Read the audio file
[audioIn, inputFs] = audioread(inputFile);
% Find the maximum absolute value in the audio data
maxValue = max(abs(audioIn));
% Display the result for each file in a more readable format using disp
disp(‘————————————————–‘);
disp([‘File: ‘, inputFile]);
disp([‘Max Value: ‘, num2str(maxValue)]);
info = audioinfo(inputFile);
disp(info);
disp(‘————————————————–‘);
end
EDIT:
The plot thickens, as a factor of sqrt(2) appears before the weights in the opus with all files I tested vs the mp3 and wav weights. Hello,
I think there is a bug with the audioread function and opus files. Somehow, I am getting maximum values read > 1. The files are perfectly fine and from a well mastered cd and opus files were made with ffmpeg from it. I have tried running this code in matlab 2023b and 2025a pre release, issue is persisting. Please help.
Output:
————————————————–
File: C:UsersAdminDesktopDatasetsCompressorinput.wav
Max Value: 0.98535 0.98593
Filename: ‘C:UsersAdminDesktopDatasetsCompressorinput.wav’
CompressionMethod: ‘Uncompressed’
NumChannels: 2
SampleRate: 44100
TotalSamples: 166800900
Duration: 3.7823e+03
Title: []
Comment: []
Artist: []
BitsPerSample: 16
————————————————–
————————————————–
"File: " "C:UsersAdminDesktopDatasetsCompressorMP3_EncodesC…"
Max Value: 1 1
Filename: ‘C:UsersAdminDesktopDatasetsCompressorMP3_EncodesCBRCBR_128_MP3.mp3’
CompressionMethod: ‘MP3’
NumChannels: 2
SampleRate: 44100
TotalSamples: 166803837
Duration: 3.7824e+03
Title: []
Comment: []
Artist: []
BitRate: 128
————————————————–
————————————————–
File: C:UsersAdminDesktopDatasetsCompressorOpus_PresetsCBRCBR_128_Opus.opus
Max Value: 1.3834 1.4113
Filename: ‘C:UsersAdminDesktopDatasetsCompressorOpus_PresetsCBRCBR_128_Opus.opus’
CompressionMethod: ‘Opus’
NumChannels: 2
SampleRate: 48000
TotalSamples: 181552000
Duration: 3.7823e+03
Title: []
Comment: []
Artist: []
————————————————–
Code to reproduce bug:
% Define the list of input files (add more file paths as needed)
inputFiles = {
‘C:UsersAdminDesktopDatasetsCompressorinput.wav’, %original wav file
"C:UsersAdminDesktopDatasetsCompressorMP3_EncodesCBRCBR_128_MP3.mp3",
‘C:UsersAdminDesktopDatasetsCompressorOpus_PresetsCBRCBR_128_Opus.opus’
};
% Loop through each input file
for i = 1:length(inputFiles)
% Get the current input file path
inputFile = inputFiles{i};
% Read the audio file
[audioIn, inputFs] = audioread(inputFile);
% Find the maximum absolute value in the audio data
maxValue = max(abs(audioIn));
% Display the result for each file in a more readable format using disp
disp(‘————————————————–‘);
disp([‘File: ‘, inputFile]);
disp([‘Max Value: ‘, num2str(maxValue)]);
info = audioinfo(inputFile);
disp(info);
disp(‘————————————————–‘);
end
EDIT:
The plot thickens, as a factor of sqrt(2) appears before the weights in the opus with all files I tested vs the mp3 and wav weights. audio, bug, audioread MATLAB Answers — New Questions
How to create inline S function?
During code generation, RTW build fails since the s function is not in line. How to manage tunable parameter in S function?During code generation, RTW build fails since the s function is not in line. How to manage tunable parameter in S function? During code generation, RTW build fails since the s function is not in line. How to manage tunable parameter in S function? formulastudent MATLAB Answers — New Questions
Assign fitlme output to a variable
Is there a way to output specific fitlme parameters? Specifically, how can I assign the t-statistic value to a specified variable? I see how to output the entire fitlme model, but not how to extract a specific value in a function.Is there a way to output specific fitlme parameters? Specifically, how can I assign the t-statistic value to a specified variable? I see how to output the entire fitlme model, but not how to extract a specific value in a function. Is there a way to output specific fitlme parameters? Specifically, how can I assign the t-statistic value to a specified variable? I see how to output the entire fitlme model, but not how to extract a specific value in a function. fitlme MATLAB Answers — New Questions
Assign fitlme output to a variable
Is there a way to output specific fitlme parameters? Specifically, how can I assign the t-statistic value to a specified variable? I see how to output the entire fitlme model, but not how to extract a specific value in a function.Is there a way to output specific fitlme parameters? Specifically, how can I assign the t-statistic value to a specified variable? I see how to output the entire fitlme model, but not how to extract a specific value in a function. Is there a way to output specific fitlme parameters? Specifically, how can I assign the t-statistic value to a specified variable? I see how to output the entire fitlme model, but not how to extract a specific value in a function. fitlme MATLAB Answers — New Questions
How can self-organized Simulink model/block information be written to a file during Simulink code generation?
I maintain some data structures in the callback functions of my customized Simulink blocks and would like to write them to a source file or a formatted configuration file when generating C code. Simulink can load custom TLC (Target Language Compiler) files through a custom System Target File and read model configuration information. TLC can read model configurations or RTW files to obtain model-related information and write the relevant data into C source files or header files. However, TLC doesn’t handle structured data well.
I have tried the following:
1. Writing data to the MATLAB workspace via the model block callback functions and then reading from TLC, but TLC cannot access the MATLAB workspace (e.g., via TLC `eval` function or %matlab or others) when generating code.
2. Writing data to a custom model configuration page (by modifying the System Target File) and then reading configuration items during TLC code generation, but this is not very friendly for complex data structures.
Is there any elegant way to pass complex private data structures into the source code? This is somewhat similar to a serialization requirement, where the callback function m in the model serializes the data, and then in C language, the data is deserialized and parsed.I maintain some data structures in the callback functions of my customized Simulink blocks and would like to write them to a source file or a formatted configuration file when generating C code. Simulink can load custom TLC (Target Language Compiler) files through a custom System Target File and read model configuration information. TLC can read model configurations or RTW files to obtain model-related information and write the relevant data into C source files or header files. However, TLC doesn’t handle structured data well.
I have tried the following:
1. Writing data to the MATLAB workspace via the model block callback functions and then reading from TLC, but TLC cannot access the MATLAB workspace (e.g., via TLC `eval` function or %matlab or others) when generating code.
2. Writing data to a custom model configuration page (by modifying the System Target File) and then reading configuration items during TLC code generation, but this is not very friendly for complex data structures.
Is there any elegant way to pass complex private data structures into the source code? This is somewhat similar to a serialization requirement, where the callback function m in the model serializes the data, and then in C language, the data is deserialized and parsed. I maintain some data structures in the callback functions of my customized Simulink blocks and would like to write them to a source file or a formatted configuration file when generating C code. Simulink can load custom TLC (Target Language Compiler) files through a custom System Target File and read model configuration information. TLC can read model configurations or RTW files to obtain model-related information and write the relevant data into C source files or header files. However, TLC doesn’t handle structured data well.
I have tried the following:
1. Writing data to the MATLAB workspace via the model block callback functions and then reading from TLC, but TLC cannot access the MATLAB workspace (e.g., via TLC `eval` function or %matlab or others) when generating code.
2. Writing data to a custom model configuration page (by modifying the System Target File) and then reading configuration items during TLC code generation, but this is not very friendly for complex data structures.
Is there any elegant way to pass complex private data structures into the source code? This is somewhat similar to a serialization requirement, where the callback function m in the model serializes the data, and then in C language, the data is deserialized and parsed. simulink, code generation, embedded coder, system target file, tlc MATLAB Answers — New Questions
How can self-organized Simulink model/block information be written to a file during Simulink code generation?
I maintain some data structures in the callback functions of my customized Simulink blocks and would like to write them to a source file or a formatted configuration file when generating C code. Simulink can load custom TLC (Target Language Compiler) files through a custom System Target File and read model configuration information. TLC can read model configurations or RTW files to obtain model-related information and write the relevant data into C source files or header files. However, TLC doesn’t handle structured data well.
I have tried the following:
1. Writing data to the MATLAB workspace via the model block callback functions and then reading from TLC, but TLC cannot access the MATLAB workspace (e.g., via TLC `eval` function or %matlab or others) when generating code.
2. Writing data to a custom model configuration page (by modifying the System Target File) and then reading configuration items during TLC code generation, but this is not very friendly for complex data structures.
Is there any elegant way to pass complex private data structures into the source code? This is somewhat similar to a serialization requirement, where the callback function m in the model serializes the data, and then in C language, the data is deserialized and parsed.I maintain some data structures in the callback functions of my customized Simulink blocks and would like to write them to a source file or a formatted configuration file when generating C code. Simulink can load custom TLC (Target Language Compiler) files through a custom System Target File and read model configuration information. TLC can read model configurations or RTW files to obtain model-related information and write the relevant data into C source files or header files. However, TLC doesn’t handle structured data well.
I have tried the following:
1. Writing data to the MATLAB workspace via the model block callback functions and then reading from TLC, but TLC cannot access the MATLAB workspace (e.g., via TLC `eval` function or %matlab or others) when generating code.
2. Writing data to a custom model configuration page (by modifying the System Target File) and then reading configuration items during TLC code generation, but this is not very friendly for complex data structures.
Is there any elegant way to pass complex private data structures into the source code? This is somewhat similar to a serialization requirement, where the callback function m in the model serializes the data, and then in C language, the data is deserialized and parsed. I maintain some data structures in the callback functions of my customized Simulink blocks and would like to write them to a source file or a formatted configuration file when generating C code. Simulink can load custom TLC (Target Language Compiler) files through a custom System Target File and read model configuration information. TLC can read model configurations or RTW files to obtain model-related information and write the relevant data into C source files or header files. However, TLC doesn’t handle structured data well.
I have tried the following:
1. Writing data to the MATLAB workspace via the model block callback functions and then reading from TLC, but TLC cannot access the MATLAB workspace (e.g., via TLC `eval` function or %matlab or others) when generating code.
2. Writing data to a custom model configuration page (by modifying the System Target File) and then reading configuration items during TLC code generation, but this is not very friendly for complex data structures.
Is there any elegant way to pass complex private data structures into the source code? This is somewhat similar to a serialization requirement, where the callback function m in the model serializes the data, and then in C language, the data is deserialized and parsed. simulink, code generation, embedded coder, system target file, tlc MATLAB Answers — New Questions
Spectrometer signal processing.
Hi guys,
I got my spectrometer data in this format save as a notepad file:
I would like to covnert time on the graph strat from 0 seconds and dont know how to covvert that.
Units_11:211
1729167932375 13:25:32.375 405650.13
1729167932475 13:25:32.475 400621.04
1729167932575 13:25:32.575 398764.17
1729167932675 13:25:32.675 400905.63
1729167932775 13:25:32.775 400606.19
1729167932875 13:25:32.875 400141.29
Can someone help me with that? Thank youHi guys,
I got my spectrometer data in this format save as a notepad file:
I would like to covnert time on the graph strat from 0 seconds and dont know how to covvert that.
Units_11:211
1729167932375 13:25:32.375 405650.13
1729167932475 13:25:32.475 400621.04
1729167932575 13:25:32.575 398764.17
1729167932675 13:25:32.675 400905.63
1729167932775 13:25:32.775 400606.19
1729167932875 13:25:32.875 400141.29
Can someone help me with that? Thank you Hi guys,
I got my spectrometer data in this format save as a notepad file:
I would like to covnert time on the graph strat from 0 seconds and dont know how to covvert that.
Units_11:211
1729167932375 13:25:32.375 405650.13
1729167932475 13:25:32.475 400621.04
1729167932575 13:25:32.575 398764.17
1729167932675 13:25:32.675 400905.63
1729167932775 13:25:32.775 400606.19
1729167932875 13:25:32.875 400141.29
Can someone help me with that? Thank you spectrometer signal processing MATLAB Answers — New Questions
Error in extracting CTF file / Could not close zip entry that was open for read
Hello, I’m using software that runs on Matlab runtime R2016b (9.1) x64 on windows 8.1
When I run the exe from a command line it exits with the following:
C:>Error in extracting CTF file to ‘L:TempAlexAlexmcrCache9.1FlopFa0’. Details: ‘Could not close zip entry that was open for read’
Could not access the MATLAB Runtime component cache. Details: Some error has occurred in the file: b:matlabstandalonemclmcrcoremclctffileextractor.cpp, at line: 64.
The error message is:
Error in extracting CTF file to ‘L:TempAlexAlexmcrCache9.1FlopFa0’. Details: ‘Could not close zip entry that was open for read’
L:Temp is the environment var temp.
So far I’ve tried:
* reinstalling (including deleting the runtime dir after uninstall)
* installing to different drives
* moving the temp folder to other drives
But the error is the same. If anyone could offer any insight/suggestiosn I’d appreciate it.
ThanksHello, I’m using software that runs on Matlab runtime R2016b (9.1) x64 on windows 8.1
When I run the exe from a command line it exits with the following:
C:>Error in extracting CTF file to ‘L:TempAlexAlexmcrCache9.1FlopFa0’. Details: ‘Could not close zip entry that was open for read’
Could not access the MATLAB Runtime component cache. Details: Some error has occurred in the file: b:matlabstandalonemclmcrcoremclctffileextractor.cpp, at line: 64.
The error message is:
Error in extracting CTF file to ‘L:TempAlexAlexmcrCache9.1FlopFa0’. Details: ‘Could not close zip entry that was open for read’
L:Temp is the environment var temp.
So far I’ve tried:
* reinstalling (including deleting the runtime dir after uninstall)
* installing to different drives
* moving the temp folder to other drives
But the error is the same. If anyone could offer any insight/suggestiosn I’d appreciate it.
Thanks Hello, I’m using software that runs on Matlab runtime R2016b (9.1) x64 on windows 8.1
When I run the exe from a command line it exits with the following:
C:>Error in extracting CTF file to ‘L:TempAlexAlexmcrCache9.1FlopFa0’. Details: ‘Could not close zip entry that was open for read’
Could not access the MATLAB Runtime component cache. Details: Some error has occurred in the file: b:matlabstandalonemclmcrcoremclctffileextractor.cpp, at line: 64.
The error message is:
Error in extracting CTF file to ‘L:TempAlexAlexmcrCache9.1FlopFa0’. Details: ‘Could not close zip entry that was open for read’
L:Temp is the environment var temp.
So far I’ve tried:
* reinstalling (including deleting the runtime dir after uninstall)
* installing to different drives
* moving the temp folder to other drives
But the error is the same. If anyone could offer any insight/suggestiosn I’d appreciate it.
Thanks startup MATLAB Answers — New Questions
plot an image with axes that match the source surface plot
I am having a problem getting a match between a surface plot and an image of the plot. This is possibly to do with NaNs along border and the problem addressed in https://uk.mathworks.com/matlabcentral/answers/484482-surf-and-nan-plotting-bug. However, I have tried a range of adjustments to the axis without success. Any pointers gratefully appreciated. Some sample code and a grid file:
%load the grid
load(‘test_grid’,’-mat’); %load the grid struct
Z = grid.z’;
hf = figure(‘Tag’,’PlotFig’);
ax = axes(hf);
C = pcolor(ax,grid.x,grid.y,Z);
shading interp
axis equal tight
delX = abs(grid.x(2)-grid.x(1));
delY = abs(grid.y(2)-grid.y(1));
xLim = xlim;
yLim = ylim;
%adjusting the x and y limits seems to have no effect on the image plot
yLim(2) = yLim(2)-delY*10;
%overlay a derived image on the original plot
hold(ax,’on’)
h_im = imagesc(‘XData’,xLim,’YData’,yLim,’CData’,C.CData);
h_im.AlphaData = 0.5;
hold(ax,’off’)I am having a problem getting a match between a surface plot and an image of the plot. This is possibly to do with NaNs along border and the problem addressed in https://uk.mathworks.com/matlabcentral/answers/484482-surf-and-nan-plotting-bug. However, I have tried a range of adjustments to the axis without success. Any pointers gratefully appreciated. Some sample code and a grid file:
%load the grid
load(‘test_grid’,’-mat’); %load the grid struct
Z = grid.z’;
hf = figure(‘Tag’,’PlotFig’);
ax = axes(hf);
C = pcolor(ax,grid.x,grid.y,Z);
shading interp
axis equal tight
delX = abs(grid.x(2)-grid.x(1));
delY = abs(grid.y(2)-grid.y(1));
xLim = xlim;
yLim = ylim;
%adjusting the x and y limits seems to have no effect on the image plot
yLim(2) = yLim(2)-delY*10;
%overlay a derived image on the original plot
hold(ax,’on’)
h_im = imagesc(‘XData’,xLim,’YData’,yLim,’CData’,C.CData);
h_im.AlphaData = 0.5;
hold(ax,’off’) I am having a problem getting a match between a surface plot and an image of the plot. This is possibly to do with NaNs along border and the problem addressed in https://uk.mathworks.com/matlabcentral/answers/484482-surf-and-nan-plotting-bug. However, I have tried a range of adjustments to the axis without success. Any pointers gratefully appreciated. Some sample code and a grid file:
%load the grid
load(‘test_grid’,’-mat’); %load the grid struct
Z = grid.z’;
hf = figure(‘Tag’,’PlotFig’);
ax = axes(hf);
C = pcolor(ax,grid.x,grid.y,Z);
shading interp
axis equal tight
delX = abs(grid.x(2)-grid.x(1));
delY = abs(grid.y(2)-grid.y(1));
xLim = xlim;
yLim = ylim;
%adjusting the x and y limits seems to have no effect on the image plot
yLim(2) = yLim(2)-delY*10;
%overlay a derived image on the original plot
hold(ax,’on’)
h_im = imagesc(‘XData’,xLim,’YData’,yLim,’CData’,C.CData);
h_im.AlphaData = 0.5;
hold(ax,’off’) imagesc, surface plot, nan data MATLAB Answers — New Questions
Non-Modal uiconfirm/uialert etc.
Is there a way to make the newer style dialog boxes like uiconfirm non modal?
I was using the jFrame method until recently but I am moving my app to a new matlab version where using jFrames directly is deprecated.
Is there a way, apart from making my own dialog boxes, to change the windowStyle? The property is not accessable and I didn’t find a way to get the handle to the dialog box.Is there a way to make the newer style dialog boxes like uiconfirm non modal?
I was using the jFrame method until recently but I am moving my app to a new matlab version where using jFrames directly is deprecated.
Is there a way, apart from making my own dialog boxes, to change the windowStyle? The property is not accessable and I didn’t find a way to get the handle to the dialog box. Is there a way to make the newer style dialog boxes like uiconfirm non modal?
I was using the jFrame method until recently but I am moving my app to a new matlab version where using jFrames directly is deprecated.
Is there a way, apart from making my own dialog boxes, to change the windowStyle? The property is not accessable and I didn’t find a way to get the handle to the dialog box. uiconfirm, uialert, modal, non modal, handles MATLAB Answers — New Questions
How to undo a delete?
How do I undo an accidental delete when using the editor for a .m file, or alternatively retrieve the .m file from before the accidental delete?How do I undo an accidental delete when using the editor for a .m file, or alternatively retrieve the .m file from before the accidental delete? How do I undo an accidental delete when using the editor for a .m file, or alternatively retrieve the .m file from before the accidental delete? editor, undelete MATLAB Answers — New Questions
Generating Gaussian Mixture Model
Hi guys,
I’ve been asked to solve the following exercise, can anyone help?
Define Gaussian mixture models in order to generate data. Use at least 2 classes, in each class use 3 clusters. The data should be generated randomly, both the latent variable and the samples. The data dimension should be at least 3.
Thanks in advanced (:Hi guys,
I’ve been asked to solve the following exercise, can anyone help?
Define Gaussian mixture models in order to generate data. Use at least 2 classes, in each class use 3 clusters. The data should be generated randomly, both the latent variable and the samples. The data dimension should be at least 3.
Thanks in advanced (: Hi guys,
I’ve been asked to solve the following exercise, can anyone help?
Define Gaussian mixture models in order to generate data. Use at least 2 classes, in each class use 3 clusters. The data should be generated randomly, both the latent variable and the samples. The data dimension should be at least 3.
Thanks in advanced (: gmm MATLAB Answers — New Questions
Radially averaged power spectrum coding
What is the coding to generate the 2D graph for radially averaged power spectrumWhat is the coding to generate the 2D graph for radially averaged power spectrum What is the coding to generate the 2D graph for radially averaged power spectrum raps coding MATLAB Answers — New Questions
reconstruction Error of 2 colored images
I have an original image of dimension 300x300x3 (RGB)
after removing some entries, I apply an algorithm to reconstuct the original image.
Now i want to find the relative error between the 2 images.
….
% I call my function norm_fro to calcuate the error
Erec(i)= norm_fro( X_origin , X_r ecovered);
….
% here is my norm_fro function
function f = norm_fro( X , Xhat )
f = norm(X -Xhat,’fro’)^2/norm(X,’fro’)^2;
end
I get this error
Error using norm
Input must be 2-D.
Error in norm_fro (line 11)
f = norm(X -Xhat,’fro’)^2/norm(X,’fro’)^2;I have an original image of dimension 300x300x3 (RGB)
after removing some entries, I apply an algorithm to reconstuct the original image.
Now i want to find the relative error between the 2 images.
….
% I call my function norm_fro to calcuate the error
Erec(i)= norm_fro( X_origin , X_r ecovered);
….
% here is my norm_fro function
function f = norm_fro( X , Xhat )
f = norm(X -Xhat,’fro’)^2/norm(X,’fro’)^2;
end
I get this error
Error using norm
Input must be 2-D.
Error in norm_fro (line 11)
f = norm(X -Xhat,’fro’)^2/norm(X,’fro’)^2; I have an original image of dimension 300x300x3 (RGB)
after removing some entries, I apply an algorithm to reconstuct the original image.
Now i want to find the relative error between the 2 images.
….
% I call my function norm_fro to calcuate the error
Erec(i)= norm_fro( X_origin , X_r ecovered);
….
% here is my norm_fro function
function f = norm_fro( X , Xhat )
f = norm(X -Xhat,’fro’)^2/norm(X,’fro’)^2;
end
I get this error
Error using norm
Input must be 2-D.
Error in norm_fro (line 11)
f = norm(X -Xhat,’fro’)^2/norm(X,’fro’)^2; error, image processing, image analysis MATLAB Answers — New Questions
problems with openProject(‘asbQuadcopter’);
hi.
i used to work with asbQuadcopter project in my lessons. This year it looks like there is a new version
i command openExample(‘aeroblks_quad/QuadcopterProjectExample’) and i get the files in /MATLAB Drive/Examples/R2024b/aeroblks_quad/QuadcopterProjectExample/asbQuadcopter’
2. i start the project with openProject(‘asbQuadcopter’) and i get the main simulink project window
3. i run the simulink and i get this error:
Error evaluating ‘InitFcn’ callback of To Video Display block (mask) ‘asbQuadcopter/Sensors/Camera Model/Camera (Airport)/To Video Display’.
Callback string is ‘import matlab.internal.capability.Capability
Capability.require(Capability.LocalClient)
‘
Caused by:
This functionality is not available on remote platforms.
Component:Simulink | Category:Block error
I looks like this 2025 year, this version can not work on remote platforms.
What can i do with 2024 and 2023 versions of asbQuadcopter in my lessons?
Best regardshi.
i used to work with asbQuadcopter project in my lessons. This year it looks like there is a new version
i command openExample(‘aeroblks_quad/QuadcopterProjectExample’) and i get the files in /MATLAB Drive/Examples/R2024b/aeroblks_quad/QuadcopterProjectExample/asbQuadcopter’
2. i start the project with openProject(‘asbQuadcopter’) and i get the main simulink project window
3. i run the simulink and i get this error:
Error evaluating ‘InitFcn’ callback of To Video Display block (mask) ‘asbQuadcopter/Sensors/Camera Model/Camera (Airport)/To Video Display’.
Callback string is ‘import matlab.internal.capability.Capability
Capability.require(Capability.LocalClient)
‘
Caused by:
This functionality is not available on remote platforms.
Component:Simulink | Category:Block error
I looks like this 2025 year, this version can not work on remote platforms.
What can i do with 2024 and 2023 versions of asbQuadcopter in my lessons?
Best regards hi.
i used to work with asbQuadcopter project in my lessons. This year it looks like there is a new version
i command openExample(‘aeroblks_quad/QuadcopterProjectExample’) and i get the files in /MATLAB Drive/Examples/R2024b/aeroblks_quad/QuadcopterProjectExample/asbQuadcopter’
2. i start the project with openProject(‘asbQuadcopter’) and i get the main simulink project window
3. i run the simulink and i get this error:
Error evaluating ‘InitFcn’ callback of To Video Display block (mask) ‘asbQuadcopter/Sensors/Camera Model/Camera (Airport)/To Video Display’.
Callback string is ‘import matlab.internal.capability.Capability
Capability.require(Capability.LocalClient)
‘
Caused by:
This functionality is not available on remote platforms.
Component:Simulink | Category:Block error
I looks like this 2025 year, this version can not work on remote platforms.
What can i do with 2024 and 2023 versions of asbQuadcopter in my lessons?
Best regards asbquadcopter MATLAB Answers — New Questions
How can I find the values through the excel field that I imported to matlab?
Hello all,
While I was doing my homework I have stucked at here. I have imported an excel file into matlab and the excel file consist of values such as Gender,Age,Weight,Smoking Status and Average Blood Pressure. I need to define these following two questions but I cant find out how to put it in a matlab function. Questions are,
1- What is the blood pressure of a 45-year-old, 75 kg male smoking cigarette?
2- What is the blood pressure of a 38-year-old non-smoker woman weighing 60 kg?
Any help is appreciated,Hello all,
While I was doing my homework I have stucked at here. I have imported an excel file into matlab and the excel file consist of values such as Gender,Age,Weight,Smoking Status and Average Blood Pressure. I need to define these following two questions but I cant find out how to put it in a matlab function. Questions are,
1- What is the blood pressure of a 45-year-old, 75 kg male smoking cigarette?
2- What is the blood pressure of a 38-year-old non-smoker woman weighing 60 kg?
Any help is appreciated, Hello all,
While I was doing my homework I have stucked at here. I have imported an excel file into matlab and the excel file consist of values such as Gender,Age,Weight,Smoking Status and Average Blood Pressure. I need to define these following two questions but I cant find out how to put it in a matlab function. Questions are,
1- What is the blood pressure of a 45-year-old, 75 kg male smoking cigarette?
2- What is the blood pressure of a 38-year-old non-smoker woman weighing 60 kg?
Any help is appreciated, importing excel data, blood pressure, smoking MATLAB Answers — New Questions
In Vehicle Body 3dof Longitudinal, how to determine suspension parameter?
What is the meaning of arrangement of FxkF, dzsF, FsbF, dzdotsF?What is the meaning of arrangement of FxkF, dzsF, FsbF, dzdotsF? What is the meaning of arrangement of FxkF, dzsF, FsbF, dzdotsF? suspension, vehicle body 3dof longitudinal MATLAB Answers — New Questions
Possible to prematurely stop single workers in a parsim simulation
I am running a parsim simulation for a simulink model in R2023B. Here, I experience single workers getting stuck in the simulation, during compilation or in a ‘queued’ state, some of these later aborting the simulation.
For exploratory simulation, it is not necessary for my simulation run to have every simulation successfully run, I can tolerate a few fails for overall speed gain.
So, my idea would be to set a timeout for each simulation and prematurely stop the simulation, ideally with a timeout error for later processing, if the overall worker occupation of a single run exceeds a set time. This should include queueing and compilation.
I have found this related article on stopping the whole pool using a postSimFunction, and plan to use this to evaluate the run time of each other worker after one simulation has finished, stopping these that take too long.
However, I fail to measure single worker duration and aborting a single simulation on a worker from this postSimfunction. Are there any good ways on how to do that?
If that cannot be done, is it possible to place some form or real-time clock in a simulink simulation to detect simulation duration and finish the simulation based on that criterion?
Thank you for your help.I am running a parsim simulation for a simulink model in R2023B. Here, I experience single workers getting stuck in the simulation, during compilation or in a ‘queued’ state, some of these later aborting the simulation.
For exploratory simulation, it is not necessary for my simulation run to have every simulation successfully run, I can tolerate a few fails for overall speed gain.
So, my idea would be to set a timeout for each simulation and prematurely stop the simulation, ideally with a timeout error for later processing, if the overall worker occupation of a single run exceeds a set time. This should include queueing and compilation.
I have found this related article on stopping the whole pool using a postSimFunction, and plan to use this to evaluate the run time of each other worker after one simulation has finished, stopping these that take too long.
However, I fail to measure single worker duration and aborting a single simulation on a worker from this postSimfunction. Are there any good ways on how to do that?
If that cannot be done, is it possible to place some form or real-time clock in a simulink simulation to detect simulation duration and finish the simulation based on that criterion?
Thank you for your help. I am running a parsim simulation for a simulink model in R2023B. Here, I experience single workers getting stuck in the simulation, during compilation or in a ‘queued’ state, some of these later aborting the simulation.
For exploratory simulation, it is not necessary for my simulation run to have every simulation successfully run, I can tolerate a few fails for overall speed gain.
So, my idea would be to set a timeout for each simulation and prematurely stop the simulation, ideally with a timeout error for later processing, if the overall worker occupation of a single run exceeds a set time. This should include queueing and compilation.
I have found this related article on stopping the whole pool using a postSimFunction, and plan to use this to evaluate the run time of each other worker after one simulation has finished, stopping these that take too long.
However, I fail to measure single worker duration and aborting a single simulation on a worker from this postSimfunction. Are there any good ways on how to do that?
If that cannot be done, is it possible to place some form or real-time clock in a simulink simulation to detect simulation duration and finish the simulation based on that criterion?
Thank you for your help. parallel computing, simulation control MATLAB Answers — New Questions
How can I display a figure in the entrire screen of a second monitor without toolbars/whitespace/greyspace around it?
I am trying to project various different sine waves onto a scene using a projector in order to obtain depth information. My current method involves a projector currently acting as my second monitor connected through display port. I’m then trying to fit a figure of the sinewaves to the monitor such that there is nothing around the edges, just the sinewave pattern. The code I have been trying is this:
time = 1:0.001:2;
frequency = 60;
phase = 90;
phase_in_rad = degtorad(phase); %Ignore these for the time being
y=0.5*cos((2*pi*frequency*time)+(2*pi/3));
plot(time,y);
print(‘SineWaveImage’,’-djpeg’);
fig1 = figure;
imshow(imread(‘SineWaveImage.jpg’));
pos_fig1 = [0 0 1900 2000];
set(fig1,’Position’,pos_fig1,’ToolBar’,’none’,’MenuBar’,’none’)
I have been attempting to change pos_fig1 so that the projector projects only the sinewaves and no grey/white space. I’ve also tried a function that cuts a lot of the white space successfully, but still suffers from the grey space when it is put back into a figure.
Is there a better way of writing this code, or any other methods of achieving this? Thanks for any helpI am trying to project various different sine waves onto a scene using a projector in order to obtain depth information. My current method involves a projector currently acting as my second monitor connected through display port. I’m then trying to fit a figure of the sinewaves to the monitor such that there is nothing around the edges, just the sinewave pattern. The code I have been trying is this:
time = 1:0.001:2;
frequency = 60;
phase = 90;
phase_in_rad = degtorad(phase); %Ignore these for the time being
y=0.5*cos((2*pi*frequency*time)+(2*pi/3));
plot(time,y);
print(‘SineWaveImage’,’-djpeg’);
fig1 = figure;
imshow(imread(‘SineWaveImage.jpg’));
pos_fig1 = [0 0 1900 2000];
set(fig1,’Position’,pos_fig1,’ToolBar’,’none’,’MenuBar’,’none’)
I have been attempting to change pos_fig1 so that the projector projects only the sinewaves and no grey/white space. I’ve also tried a function that cuts a lot of the white space successfully, but still suffers from the grey space when it is put back into a figure.
Is there a better way of writing this code, or any other methods of achieving this? Thanks for any help I am trying to project various different sine waves onto a scene using a projector in order to obtain depth information. My current method involves a projector currently acting as my second monitor connected through display port. I’m then trying to fit a figure of the sinewaves to the monitor such that there is nothing around the edges, just the sinewave pattern. The code I have been trying is this:
time = 1:0.001:2;
frequency = 60;
phase = 90;
phase_in_rad = degtorad(phase); %Ignore these for the time being
y=0.5*cos((2*pi*frequency*time)+(2*pi/3));
plot(time,y);
print(‘SineWaveImage’,’-djpeg’);
fig1 = figure;
imshow(imread(‘SineWaveImage.jpg’));
pos_fig1 = [0 0 1900 2000];
set(fig1,’Position’,pos_fig1,’ToolBar’,’none’,’MenuBar’,’none’)
I have been attempting to change pos_fig1 so that the projector projects only the sinewaves and no grey/white space. I’ve also tried a function that cuts a lot of the white space successfully, but still suffers from the grey space when it is put back into a figure.
Is there a better way of writing this code, or any other methods of achieving this? Thanks for any help digital image processing, signal processing MATLAB Answers — New Questions