Category: News
Is there any way I can keep the “UIAxes” at the front of “UITable”?
How can I keep the "UIAxes" in front of the "UITable" in my MATLAB UI application?How can I keep the "UIAxes" in front of the "UITable" in my MATLAB UI application? How can I keep the "UIAxes" in front of the "UITable" in my MATLAB UI application? uiaxes, front, uitable MATLAB Answers — New Questions
Why does using “cd” with “dos” command does not work with switch directories?
The "dos" command does not work as expected for switching directory with "cd" command.
>> [status, cmdout] = dos(‘cd C:’)
cmdout =
0×0 empty char array
However, the "dos" command works for different operations like "dir" fine.
>> [status, cmdout] = dos(‘dir’)
cmdout =
‘ Volume in drive C is Windows
Volume Serial Number is 6405-C0AD
Directory of C:Users………..
12/26/2024 04:35 PM <DIR> .
12/30/2024 02:49 PM <DIR> ..
Why does "dos" command work with "dir" but not with "cd"?The "dos" command does not work as expected for switching directory with "cd" command.
>> [status, cmdout] = dos(‘cd C:’)
cmdout =
0×0 empty char array
However, the "dos" command works for different operations like "dir" fine.
>> [status, cmdout] = dos(‘dir’)
cmdout =
‘ Volume in drive C is Windows
Volume Serial Number is 6405-C0AD
Directory of C:Users………..
12/26/2024 04:35 PM <DIR> .
12/30/2024 02:49 PM <DIR> ..
Why does "dos" command work with "dir" but not with "cd"? The "dos" command does not work as expected for switching directory with "cd" command.
>> [status, cmdout] = dos(‘cd C:’)
cmdout =
0×0 empty char array
However, the "dos" command works for different operations like "dir" fine.
>> [status, cmdout] = dos(‘dir’)
cmdout =
‘ Volume in drive C is Windows
Volume Serial Number is 6405-C0AD
Directory of C:Users………..
12/26/2024 04:35 PM <DIR> .
12/30/2024 02:49 PM <DIR> ..
Why does "dos" command work with "dir" but not with "cd"? doscommand, cdcommand, switchingdirectories MATLAB Answers — New Questions
How can I configure my Docker microservice to use SSL/HTTPS?
I have created a Docker microservice image using the ‘compiler.package.microserviceDockerImage’ workflow. It is working correctly, but I would like to configure it to use HTTPS instead of HTTP. How can I accomplish this? I have an existing private key that I would like to use.I have created a Docker microservice image using the ‘compiler.package.microserviceDockerImage’ workflow. It is working correctly, but I would like to configure it to use HTTPS instead of HTTP. How can I accomplish this? I have an existing private key that I would like to use. I have created a Docker microservice image using the ‘compiler.package.microserviceDockerImage’ workflow. It is working correctly, but I would like to configure it to use HTTPS instead of HTTP. How can I accomplish this? I have an existing private key that I would like to use. docker, microservice, ssl, https, api, private-key MATLAB Answers — New Questions
How can I continue a Simscape simulation after altering some blockparameters?
Hi,
I am using fast restart to run Simscape model. I have the initial states of the blocks as block parameters defined in the matlab workspace. I would like to change certain parameters (say change the pressure at one point to a higher value) to simulate an external event and continue the simulation without altering rest of the system state. Preferably using fast restart. What is the cleanest way to achieve this? Is is possible to reinitialize just a single block using setBlockParameter() function and contine the simulation?
I have tried:
Run simulation -> save state -> change blockparameters (structs defined in workspace) -> load state ->run.
This doesnt work as I get the following error:
‘Simulink cannot load the initial operating point because the model, ‘model..’, was changed after the operating point was saved. Run the simulation again and resave the operating point.’
I already verified that the struct that is being changed is of the same dimensions and datatype after, just their numerical values are changed.Hi,
I am using fast restart to run Simscape model. I have the initial states of the blocks as block parameters defined in the matlab workspace. I would like to change certain parameters (say change the pressure at one point to a higher value) to simulate an external event and continue the simulation without altering rest of the system state. Preferably using fast restart. What is the cleanest way to achieve this? Is is possible to reinitialize just a single block using setBlockParameter() function and contine the simulation?
I have tried:
Run simulation -> save state -> change blockparameters (structs defined in workspace) -> load state ->run.
This doesnt work as I get the following error:
‘Simulink cannot load the initial operating point because the model, ‘model..’, was changed after the operating point was saved. Run the simulation again and resave the operating point.’
I already verified that the struct that is being changed is of the same dimensions and datatype after, just their numerical values are changed. Hi,
I am using fast restart to run Simscape model. I have the initial states of the blocks as block parameters defined in the matlab workspace. I would like to change certain parameters (say change the pressure at one point to a higher value) to simulate an external event and continue the simulation without altering rest of the system state. Preferably using fast restart. What is the cleanest way to achieve this? Is is possible to reinitialize just a single block using setBlockParameter() function and contine the simulation?
I have tried:
Run simulation -> save state -> change blockparameters (structs defined in workspace) -> load state ->run.
This doesnt work as I get the following error:
‘Simulink cannot load the initial operating point because the model, ‘model..’, was changed after the operating point was saved. Run the simulation again and resave the operating point.’
I already verified that the struct that is being changed is of the same dimensions and datatype after, just their numerical values are changed. simscape, fastrestart, simulink MATLAB Answers — New Questions
Using simscape’s unidirectional clutch with multibody
Hello,
I am trying to attach a unidirectional clutch to a revolute joint using a multibody rotational interface and a rotational reference however this doesn’t seem to work.
What happen is that the "disengaged phase" goes well but at the moment the relative velocity between the hub and the ring changes direction the simulation crashes with the following message :
An error occurred during simulation and the simulation was terminated
Caused by:
[‘Modele_RZ/Solver Configuration’]: Transient initialization at time 1.903, solving for consistent states and modes, failed to converge.
Nonlinear solver: Linear Algebra error. Failed to solve using iteration matrix.
The model may not give enough information to make it possible to solve for values of some of its variables. Specific advice is given below.
all components and nodal across variables involved
Cannot solve for one or more variables:
‘Roue_Libre_Haut_Avant.Rotational_Multibody_Interface.t’ (t)
‘Roue_Libre_Haut_Avant.Rotational_Multibody_Interface.torque’ (Torque)
‘Roue_Libre_Haut_Avant.Rotational_Multibody_Interface_t0’ (Rotational_Multibody_Interface_t0)
‘Roue_Libre_Haut_Avant.Unidirectional_Clutch.fundamental_clutch.clutch.t’ (Torque)
‘Roue_Libre_Haut_Avant.Unidirectional_Clutch.fundamental_clutch.torque’ (Torque)
I have tried a bunch of modification but nothing seems to work…
I would appreciate a bit of help.Hello,
I am trying to attach a unidirectional clutch to a revolute joint using a multibody rotational interface and a rotational reference however this doesn’t seem to work.
What happen is that the "disengaged phase" goes well but at the moment the relative velocity between the hub and the ring changes direction the simulation crashes with the following message :
An error occurred during simulation and the simulation was terminated
Caused by:
[‘Modele_RZ/Solver Configuration’]: Transient initialization at time 1.903, solving for consistent states and modes, failed to converge.
Nonlinear solver: Linear Algebra error. Failed to solve using iteration matrix.
The model may not give enough information to make it possible to solve for values of some of its variables. Specific advice is given below.
all components and nodal across variables involved
Cannot solve for one or more variables:
‘Roue_Libre_Haut_Avant.Rotational_Multibody_Interface.t’ (t)
‘Roue_Libre_Haut_Avant.Rotational_Multibody_Interface.torque’ (Torque)
‘Roue_Libre_Haut_Avant.Rotational_Multibody_Interface_t0’ (Rotational_Multibody_Interface_t0)
‘Roue_Libre_Haut_Avant.Unidirectional_Clutch.fundamental_clutch.clutch.t’ (Torque)
‘Roue_Libre_Haut_Avant.Unidirectional_Clutch.fundamental_clutch.torque’ (Torque)
I have tried a bunch of modification but nothing seems to work…
I would appreciate a bit of help. Hello,
I am trying to attach a unidirectional clutch to a revolute joint using a multibody rotational interface and a rotational reference however this doesn’t seem to work.
What happen is that the "disengaged phase" goes well but at the moment the relative velocity between the hub and the ring changes direction the simulation crashes with the following message :
An error occurred during simulation and the simulation was terminated
Caused by:
[‘Modele_RZ/Solver Configuration’]: Transient initialization at time 1.903, solving for consistent states and modes, failed to converge.
Nonlinear solver: Linear Algebra error. Failed to solve using iteration matrix.
The model may not give enough information to make it possible to solve for values of some of its variables. Specific advice is given below.
all components and nodal across variables involved
Cannot solve for one or more variables:
‘Roue_Libre_Haut_Avant.Rotational_Multibody_Interface.t’ (t)
‘Roue_Libre_Haut_Avant.Rotational_Multibody_Interface.torque’ (Torque)
‘Roue_Libre_Haut_Avant.Rotational_Multibody_Interface_t0’ (Rotational_Multibody_Interface_t0)
‘Roue_Libre_Haut_Avant.Unidirectional_Clutch.fundamental_clutch.clutch.t’ (Torque)
‘Roue_Libre_Haut_Avant.Unidirectional_Clutch.fundamental_clutch.torque’ (Torque)
I have tried a bunch of modification but nothing seems to work…
I would appreciate a bit of help. simscape, multibody, clutch, simulink MATLAB Answers — New Questions
Failed to create COM objectMatlabWrapper.wrapper: Automation error
Hi everyone,
Please, I have an application that uses MATLAB Runtime 9.9 (with Windows Server 2019 Std) and I’m facing the following error message:
"Failed to create COM objectMatlabWrapper.wrapper: Automation errorThe specified module could no be found".
Please, any tip to solve this issue?
Thanks.Hi everyone,
Please, I have an application that uses MATLAB Runtime 9.9 (with Windows Server 2019 Std) and I’m facing the following error message:
"Failed to create COM objectMatlabWrapper.wrapper: Automation errorThe specified module could no be found".
Please, any tip to solve this issue?
Thanks. Hi everyone,
Please, I have an application that uses MATLAB Runtime 9.9 (with Windows Server 2019 Std) and I’m facing the following error message:
"Failed to create COM objectMatlabWrapper.wrapper: Automation errorThe specified module could no be found".
Please, any tip to solve this issue?
Thanks. matlab runtime MATLAB Answers — New Questions
Trouble parsing ISO8601 date strings into datetime
Hi there I am trying to take some datasets with what I believe are ISO8601 timecodes and convert the timecodes to datetime for plotting and sorting by date and time. I think it is the data after the ‘+’ that is tripping me up, but I haven’t been able to find the right solution.
here is an example of one of the data entries, and the line that I am trying to excecute
Example data: "2023-06-09T23:55:00+00:00"
solardates= datetime(solar.Date,’InputFormat’,’uuuu-MM-dd”T”HH:mm:ss”+’,’TimeZone’,’UTC’);
And here are the errors I get when running the code.
Error using datetime (line 257)
Unable to convert the text to datetime using the format ‘uuuu-MM-dd’T’HH:mm:ss’+’.
Error in HistTest (line 30)
solardates= datetime(solar.Date,’InputFormat’,’uuuu-MM-dd”T”HH:mm:ss”+’,’TimeZone’,’UTC’);Hi there I am trying to take some datasets with what I believe are ISO8601 timecodes and convert the timecodes to datetime for plotting and sorting by date and time. I think it is the data after the ‘+’ that is tripping me up, but I haven’t been able to find the right solution.
here is an example of one of the data entries, and the line that I am trying to excecute
Example data: "2023-06-09T23:55:00+00:00"
solardates= datetime(solar.Date,’InputFormat’,’uuuu-MM-dd”T”HH:mm:ss”+’,’TimeZone’,’UTC’);
And here are the errors I get when running the code.
Error using datetime (line 257)
Unable to convert the text to datetime using the format ‘uuuu-MM-dd’T’HH:mm:ss’+’.
Error in HistTest (line 30)
solardates= datetime(solar.Date,’InputFormat’,’uuuu-MM-dd”T”HH:mm:ss”+’,’TimeZone’,’UTC’); Hi there I am trying to take some datasets with what I believe are ISO8601 timecodes and convert the timecodes to datetime for plotting and sorting by date and time. I think it is the data after the ‘+’ that is tripping me up, but I haven’t been able to find the right solution.
here is an example of one of the data entries, and the line that I am trying to excecute
Example data: "2023-06-09T23:55:00+00:00"
solardates= datetime(solar.Date,’InputFormat’,’uuuu-MM-dd”T”HH:mm:ss”+’,’TimeZone’,’UTC’);
And here are the errors I get when running the code.
Error using datetime (line 257)
Unable to convert the text to datetime using the format ‘uuuu-MM-dd’T’HH:mm:ss’+’.
Error in HistTest (line 30)
solardates= datetime(solar.Date,’InputFormat’,’uuuu-MM-dd”T”HH:mm:ss”+’,’TimeZone’,’UTC’); datetime, iso8601, iso 8601 MATLAB Answers — New Questions
How do I extract the contents of an HTML table on a web page into a MATLAB table?
I’d like to plot and analyze the TSA traveler data from this website: https://www.tsa.gov/coronavirus/passenger-throughput
The data is embedded on the page as an HTML table element.
How do I extract the table content into a MATLAB table?I’d like to plot and analyze the TSA traveler data from this website: https://www.tsa.gov/coronavirus/passenger-throughput
The data is embedded on the page as an HTML table element.
How do I extract the table content into a MATLAB table? I’d like to plot and analyze the TSA traveler data from this website: https://www.tsa.gov/coronavirus/passenger-throughput
The data is embedded on the page as an HTML table element.
How do I extract the table content into a MATLAB table? html, table MATLAB Answers — New Questions
How to repaire MATLAB has experienced a low-level graphics error ?
MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
To share details of this issue with MathWorks technical support,
please include this file with your service request.MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
To share details of this issue with MathWorks technical support,
please include this file with your service request. MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
To share details of this issue with MathWorks technical support,
please include this file with your service request. #matword MATLAB Answers — New Questions
display ‰ symbol in xlabel with latex interpreter
Hi,
I need to display a permil (textperthousand) in my xlabel but I cannot get it to work.
I’m using the following
ylabel(‘$mathrm{^{34/32}varepsilon^{mic}_{sulfate-pyrite} (textperthousand)}$’,’FontSize’,16,’Interpreter’,’latex’)Hi,
I need to display a permil (textperthousand) in my xlabel but I cannot get it to work.
I’m using the following
ylabel(‘$mathrm{^{34/32}varepsilon^{mic}_{sulfate-pyrite} (textperthousand)}$’,’FontSize’,16,’Interpreter’,’latex’) Hi,
I need to display a permil (textperthousand) in my xlabel but I cannot get it to work.
I’m using the following
ylabel(‘$mathrm{^{34/32}varepsilon^{mic}_{sulfate-pyrite} (textperthousand)}$’,’FontSize’,16,’Interpreter’,’latex’) latex, xlabel MATLAB Answers — New Questions
“N channel mosfet” conducts when Vds is negative and body diode is not modelled
I am using "N-channel MOSFET" block from simscape and i have an observation which is not plausible.
When Vds is negative the mosfet conducts. I am using threshold based modelling, parametrization from datasheet, and body diode is not modelled. Using default values when block is inserted. Tried in matlab 2021b, 2023b
Am I missing something here or is it a bug?I am using "N-channel MOSFET" block from simscape and i have an observation which is not plausible.
When Vds is negative the mosfet conducts. I am using threshold based modelling, parametrization from datasheet, and body diode is not modelled. Using default values when block is inserted. Tried in matlab 2021b, 2023b
Am I missing something here or is it a bug? I am using "N-channel MOSFET" block from simscape and i have an observation which is not plausible.
When Vds is negative the mosfet conducts. I am using threshold based modelling, parametrization from datasheet, and body diode is not modelled. Using default values when block is inserted. Tried in matlab 2021b, 2023b
Am I missing something here or is it a bug? simulink, simscape, electrical, mosfet, nmos MATLAB Answers — New Questions
How to get a list of listeners
I am currently working on a fairly large Matlab OOP codebase, with listeners defined all over the place. Unfortunately the guy who created this codebase left the company and there is not really any documentation available.
As there are so many listeners all over the place, simply querying or changing some object property frequently has unexpected side effects, making debugging very painful. Is there a simple way to get a list of all the listeners for a given property? E.g. something to the extent of getlisteners(obj.myProperty)? This would really help in figuring out what on earth the code is actually doing…
I would have expected this to be a quite basic question but somehow can not find a simple answer anywhere.
Thanks!
GijsI am currently working on a fairly large Matlab OOP codebase, with listeners defined all over the place. Unfortunately the guy who created this codebase left the company and there is not really any documentation available.
As there are so many listeners all over the place, simply querying or changing some object property frequently has unexpected side effects, making debugging very painful. Is there a simple way to get a list of all the listeners for a given property? E.g. something to the extent of getlisteners(obj.myProperty)? This would really help in figuring out what on earth the code is actually doing…
I would have expected this to be a quite basic question but somehow can not find a simple answer anywhere.
Thanks!
Gijs I am currently working on a fairly large Matlab OOP codebase, with listeners defined all over the place. Unfortunately the guy who created this codebase left the company and there is not really any documentation available.
As there are so many listeners all over the place, simply querying or changing some object property frequently has unexpected side effects, making debugging very painful. Is there a simple way to get a list of all the listeners for a given property? E.g. something to the extent of getlisteners(obj.myProperty)? This would really help in figuring out what on earth the code is actually doing…
I would have expected this to be a quite basic question but somehow can not find a simple answer anywhere.
Thanks!
Gijs events, listeners MATLAB Answers — New Questions
How can insert a ‘bodeplot’ in an axes object of AppDesigner.
Hi,
I have an application developed in the past (Matlab 2013b) with several chained GUI´s sharing information. The application was build to aid the engineers of the control section during the tasks of tunning some control loops used at the company. Now, I am migrating the application to Matlab 2020a with AppDesigner, and I have found a problem with the calls to the Matlab function ‘bodeplot’.
"Error using DynamicSystem/bodeplot (line 113)
Functionality not supported with figures created with the uifigure function. For more information, see Graphics Support in App Designer."
In my application, the calls to the function bodeplot, always have a signature similar to this:
bodeplot(handle_axis_n, sys)
Where ‘handle_axis_n’ is the handle of the axes object where the bode diagram should be plotted, and ‘sys’ the LTI object.
And are coherent with the expected signature documented in the bodeplot manual: ‘https://es.mathworks.com/help/control/ref/bodeplot.html’
If the function bodeplot is not supported with graphic containers of App Designer, How can I insert a bode plot in an application of App Designer?
Thanks in advance.Hi,
I have an application developed in the past (Matlab 2013b) with several chained GUI´s sharing information. The application was build to aid the engineers of the control section during the tasks of tunning some control loops used at the company. Now, I am migrating the application to Matlab 2020a with AppDesigner, and I have found a problem with the calls to the Matlab function ‘bodeplot’.
"Error using DynamicSystem/bodeplot (line 113)
Functionality not supported with figures created with the uifigure function. For more information, see Graphics Support in App Designer."
In my application, the calls to the function bodeplot, always have a signature similar to this:
bodeplot(handle_axis_n, sys)
Where ‘handle_axis_n’ is the handle of the axes object where the bode diagram should be plotted, and ‘sys’ the LTI object.
And are coherent with the expected signature documented in the bodeplot manual: ‘https://es.mathworks.com/help/control/ref/bodeplot.html’
If the function bodeplot is not supported with graphic containers of App Designer, How can I insert a bode plot in an application of App Designer?
Thanks in advance. Hi,
I have an application developed in the past (Matlab 2013b) with several chained GUI´s sharing information. The application was build to aid the engineers of the control section during the tasks of tunning some control loops used at the company. Now, I am migrating the application to Matlab 2020a with AppDesigner, and I have found a problem with the calls to the Matlab function ‘bodeplot’.
"Error using DynamicSystem/bodeplot (line 113)
Functionality not supported with figures created with the uifigure function. For more information, see Graphics Support in App Designer."
In my application, the calls to the function bodeplot, always have a signature similar to this:
bodeplot(handle_axis_n, sys)
Where ‘handle_axis_n’ is the handle of the axes object where the bode diagram should be plotted, and ‘sys’ the LTI object.
And are coherent with the expected signature documented in the bodeplot manual: ‘https://es.mathworks.com/help/control/ref/bodeplot.html’
If the function bodeplot is not supported with graphic containers of App Designer, How can I insert a bode plot in an application of App Designer?
Thanks in advance. app designer, bodeplot MATLAB Answers — New Questions
how to analyze downlink 5G waveform for mixed numerology?
downlink 5G waveform for mixed numerology is given in the toolbox examples.
How to analyse that for BER and internumerlogoy interference?
How to deal generated resource grid containing PSS, SSS, PBCH, DM-RS?downlink 5G waveform for mixed numerology is given in the toolbox examples.
How to analyse that for BER and internumerlogoy interference?
How to deal generated resource grid containing PSS, SSS, PBCH, DM-RS? downlink 5G waveform for mixed numerology is given in the toolbox examples.
How to analyse that for BER and internumerlogoy interference?
How to deal generated resource grid containing PSS, SSS, PBCH, DM-RS? ini analysis MATLAB Answers — New Questions
Dependency management & package manager like pip in ML
Hi all,
Matlab is officially still lacking a proper package manager like npm or pip. I do not understand how people structure projects with dependencies. I understand, there are
ML projects
ML toolboxes
several mpm versions
Toolboxes have a version number attached, projects have not. Both can be shared as a package. Projects can reference other projects, but that 1. requires the same folder structure on every developer PC and 2. requires that the correct version is checked out from the VCS (which is GIT in our case). There’s no way to define "project abc@v1.2.0" as a dependency. Just folders/prj files.
How do you do complex app developments? Like a frontent GUI app that needs several self-created toolboxes and projects? The only way is to use GIT (submodules in worst case) to do dependency managment, and that’s definitely a red flag.
Then, there’s Matlab’s mpm matlab-dockerfile/MPM.md at main · mathworks-ref-arch/matlab-dockerfile (github.com) but that’s meant to be used to install different product versions and addons, and there’s a third party mpm mobeets/mpm: Simple Matlab package management inspired by pip (github.com) which seems to be interesting, but there’s no direct support from Mathworks.
Then, it seems like there’s another mpm built-in in ML 2022b that mentions a Matlab -packages flag which is very interesting:
mpm
There’s no information about that. Starting ML with -packages reveals more:
Which seems to support different versions. But there’s no documentation anywhere, and it’s a built-in function © 2022.
What does that mean? Will there be a Mathworks’ supported package manager? What exactly is a package by the way in ML? So far, packages were a synonym to namespaces, using the +package folders. How does that work together with ML projects?
I’m in the process of re-structuring code due to a migration from Bitbucket to Gitlab and I’m at a point where a proper dependency management must take place, and that must work in CI/CD, too.
Would be very happy to hear your thoughts.
Thanks,
JanHi all,
Matlab is officially still lacking a proper package manager like npm or pip. I do not understand how people structure projects with dependencies. I understand, there are
ML projects
ML toolboxes
several mpm versions
Toolboxes have a version number attached, projects have not. Both can be shared as a package. Projects can reference other projects, but that 1. requires the same folder structure on every developer PC and 2. requires that the correct version is checked out from the VCS (which is GIT in our case). There’s no way to define "project abc@v1.2.0" as a dependency. Just folders/prj files.
How do you do complex app developments? Like a frontent GUI app that needs several self-created toolboxes and projects? The only way is to use GIT (submodules in worst case) to do dependency managment, and that’s definitely a red flag.
Then, there’s Matlab’s mpm matlab-dockerfile/MPM.md at main · mathworks-ref-arch/matlab-dockerfile (github.com) but that’s meant to be used to install different product versions and addons, and there’s a third party mpm mobeets/mpm: Simple Matlab package management inspired by pip (github.com) which seems to be interesting, but there’s no direct support from Mathworks.
Then, it seems like there’s another mpm built-in in ML 2022b that mentions a Matlab -packages flag which is very interesting:
mpm
There’s no information about that. Starting ML with -packages reveals more:
Which seems to support different versions. But there’s no documentation anywhere, and it’s a built-in function © 2022.
What does that mean? Will there be a Mathworks’ supported package manager? What exactly is a package by the way in ML? So far, packages were a synonym to namespaces, using the +package folders. How does that work together with ML projects?
I’m in the process of re-structuring code due to a migration from Bitbucket to Gitlab and I’m at a point where a proper dependency management must take place, and that must work in CI/CD, too.
Would be very happy to hear your thoughts.
Thanks,
Jan Hi all,
Matlab is officially still lacking a proper package manager like npm or pip. I do not understand how people structure projects with dependencies. I understand, there are
ML projects
ML toolboxes
several mpm versions
Toolboxes have a version number attached, projects have not. Both can be shared as a package. Projects can reference other projects, but that 1. requires the same folder structure on every developer PC and 2. requires that the correct version is checked out from the VCS (which is GIT in our case). There’s no way to define "project abc@v1.2.0" as a dependency. Just folders/prj files.
How do you do complex app developments? Like a frontent GUI app that needs several self-created toolboxes and projects? The only way is to use GIT (submodules in worst case) to do dependency managment, and that’s definitely a red flag.
Then, there’s Matlab’s mpm matlab-dockerfile/MPM.md at main · mathworks-ref-arch/matlab-dockerfile (github.com) but that’s meant to be used to install different product versions and addons, and there’s a third party mpm mobeets/mpm: Simple Matlab package management inspired by pip (github.com) which seems to be interesting, but there’s no direct support from Mathworks.
Then, it seems like there’s another mpm built-in in ML 2022b that mentions a Matlab -packages flag which is very interesting:
mpm
There’s no information about that. Starting ML with -packages reveals more:
Which seems to support different versions. But there’s no documentation anywhere, and it’s a built-in function © 2022.
What does that mean? Will there be a Mathworks’ supported package manager? What exactly is a package by the way in ML? So far, packages were a synonym to namespaces, using the +package folders. How does that work together with ML projects?
I’m in the process of re-structuring code due to a migration from Bitbucket to Gitlab and I’m at a point where a proper dependency management must take place, and that must work in CI/CD, too.
Would be very happy to hear your thoughts.
Thanks,
Jan mpm, dependency management, matlab projects, pip MATLAB Answers — New Questions
Change marker colour of pzplot
Hello everyone
I’m trying to change the marker color in the pzplot graph. I’m using version 2024b.
Apparently, in this version, a new object(?) called "PZPlot Properties" was introduced, which is great.
Using this new object, I can easily change the size and line thickness of all markers. But I can also only change the colour of all markers. I’d like to change the colours of the markers for the poles and zeros separately.
I tried using the "findobj" method and found, that the PZPlot apparently consists of two Scatter-Plots called "PZPoleScatter" and "PZZeroScatter", and I tried changing the color of the markers in those Scatter plots, but this does not seem to have an effect on the markers.
When I change the colour of the markers using the PZPlot properties Object, I see the color definition of the markers in both scatter plots change, and I can also see that the colours change if I directly access the properties and change the colour, but the plot isn’t drawn with those correct colors.
I tried using refresh after changing the values, but that doesn’t have any effect either.
See my code below:
s = tf(‘s’);
f = (1 + 1/s)
pzp = pzplot(f);
% See https://ch.mathworks.com/help/ident/ref/controllib.chart.pzplot-properties.html for new PZPlot-properties object
pzp.Responses.MarkerSize = 10;
pzp.Responses.LineWidth = 2;
%pzp.Responses.Color = ‘green’; % Changes colour of all markers
oPole = findobj(gca, ‘Tag’, ‘PZPoleScatter’);
oPole.MarkerEdgeColor = ‘red’;
oZero = findobj(gca, ‘Tag’, ‘PZZeroScatter’);
oZero.MarkerEdgeColor = ‘blue’;
rsp = findobj(gca, ‘Tag’, ‘PZPoleScatter’); % read object again to see if properties got changed correctly
I also found the following two topics, but they do not work anymore as there is no "Line" child in the PZPlot object.
https://ch.mathworks.com/matlabcentral/answers/276605-change-pzplot-marker-size
https://ch.mathworks.com/matlabcentral/answers/431293-i-am-using-pole-zero-map-pzmap-and-i-want-to-enhance-the-size-of-pole-or-zero-or-in-other-words-iHello everyone
I’m trying to change the marker color in the pzplot graph. I’m using version 2024b.
Apparently, in this version, a new object(?) called "PZPlot Properties" was introduced, which is great.
Using this new object, I can easily change the size and line thickness of all markers. But I can also only change the colour of all markers. I’d like to change the colours of the markers for the poles and zeros separately.
I tried using the "findobj" method and found, that the PZPlot apparently consists of two Scatter-Plots called "PZPoleScatter" and "PZZeroScatter", and I tried changing the color of the markers in those Scatter plots, but this does not seem to have an effect on the markers.
When I change the colour of the markers using the PZPlot properties Object, I see the color definition of the markers in both scatter plots change, and I can also see that the colours change if I directly access the properties and change the colour, but the plot isn’t drawn with those correct colors.
I tried using refresh after changing the values, but that doesn’t have any effect either.
See my code below:
s = tf(‘s’);
f = (1 + 1/s)
pzp = pzplot(f);
% See https://ch.mathworks.com/help/ident/ref/controllib.chart.pzplot-properties.html for new PZPlot-properties object
pzp.Responses.MarkerSize = 10;
pzp.Responses.LineWidth = 2;
%pzp.Responses.Color = ‘green’; % Changes colour of all markers
oPole = findobj(gca, ‘Tag’, ‘PZPoleScatter’);
oPole.MarkerEdgeColor = ‘red’;
oZero = findobj(gca, ‘Tag’, ‘PZZeroScatter’);
oZero.MarkerEdgeColor = ‘blue’;
rsp = findobj(gca, ‘Tag’, ‘PZPoleScatter’); % read object again to see if properties got changed correctly
I also found the following two topics, but they do not work anymore as there is no "Line" child in the PZPlot object.
https://ch.mathworks.com/matlabcentral/answers/276605-change-pzplot-marker-size
https://ch.mathworks.com/matlabcentral/answers/431293-i-am-using-pole-zero-map-pzmap-and-i-want-to-enhance-the-size-of-pole-or-zero-or-in-other-words-i Hello everyone
I’m trying to change the marker color in the pzplot graph. I’m using version 2024b.
Apparently, in this version, a new object(?) called "PZPlot Properties" was introduced, which is great.
Using this new object, I can easily change the size and line thickness of all markers. But I can also only change the colour of all markers. I’d like to change the colours of the markers for the poles and zeros separately.
I tried using the "findobj" method and found, that the PZPlot apparently consists of two Scatter-Plots called "PZPoleScatter" and "PZZeroScatter", and I tried changing the color of the markers in those Scatter plots, but this does not seem to have an effect on the markers.
When I change the colour of the markers using the PZPlot properties Object, I see the color definition of the markers in both scatter plots change, and I can also see that the colours change if I directly access the properties and change the colour, but the plot isn’t drawn with those correct colors.
I tried using refresh after changing the values, but that doesn’t have any effect either.
See my code below:
s = tf(‘s’);
f = (1 + 1/s)
pzp = pzplot(f);
% See https://ch.mathworks.com/help/ident/ref/controllib.chart.pzplot-properties.html for new PZPlot-properties object
pzp.Responses.MarkerSize = 10;
pzp.Responses.LineWidth = 2;
%pzp.Responses.Color = ‘green’; % Changes colour of all markers
oPole = findobj(gca, ‘Tag’, ‘PZPoleScatter’);
oPole.MarkerEdgeColor = ‘red’;
oZero = findobj(gca, ‘Tag’, ‘PZZeroScatter’);
oZero.MarkerEdgeColor = ‘blue’;
rsp = findobj(gca, ‘Tag’, ‘PZPoleScatter’); % read object again to see if properties got changed correctly
I also found the following two topics, but they do not work anymore as there is no "Line" child in the PZPlot object.
https://ch.mathworks.com/matlabcentral/answers/276605-change-pzplot-marker-size
https://ch.mathworks.com/matlabcentral/answers/431293-i-am-using-pole-zero-map-pzmap-and-i-want-to-enhance-the-size-of-pole-or-zero-or-in-other-words-i pzplot, marker, customization MATLAB Answers — New Questions
Extracting values from .xml files
Dear MATLAB users,
Kindly assist me on how to extract some data from .xml file here https://drive.google.com/file/d/1Sa1ycUqO4CshesnA_BAXy_BWGbeFb8IQ/view?usp=drive_link
Below is a part copied from the file. I would like specifically extract the values in BOLD
<CouchVrt>-176.51000000000011</CouchVrt>
<CouchLng>911.7700000000001</CouchLng>
<CouchLat>22.300999999999789</CouchLat>
I have been trying to read the file using xmlread without success.
Thanks in advance.Dear MATLAB users,
Kindly assist me on how to extract some data from .xml file here https://drive.google.com/file/d/1Sa1ycUqO4CshesnA_BAXy_BWGbeFb8IQ/view?usp=drive_link
Below is a part copied from the file. I would like specifically extract the values in BOLD
<CouchVrt>-176.51000000000011</CouchVrt>
<CouchLng>911.7700000000001</CouchLng>
<CouchLat>22.300999999999789</CouchLat>
I have been trying to read the file using xmlread without success.
Thanks in advance. Dear MATLAB users,
Kindly assist me on how to extract some data from .xml file here https://drive.google.com/file/d/1Sa1ycUqO4CshesnA_BAXy_BWGbeFb8IQ/view?usp=drive_link
Below is a part copied from the file. I would like specifically extract the values in BOLD
<CouchVrt>-176.51000000000011</CouchVrt>
<CouchLng>911.7700000000001</CouchLng>
<CouchLat>22.300999999999789</CouchLat>
I have been trying to read the file using xmlread without success.
Thanks in advance. xml files, text file read MATLAB Answers — New Questions
How to counting RBC size and number
i write this code but i cant get number of rbc and this is my input image
clear all;
close all;
clc;
count=0;
RC_Im = imread(‘red_cells.png’);
RC_Im = rgb2gray(RC_Im);
level=graythresh(RC_Im);
RC_Im_BW = im2bw(RC_Im,level);
figure;
imshow(RC_Im_BW,[])
[x,z]=size(RC_Im_BW);
for R=0:1:60
SE = strel(‘disk’,R);
afteropen=imopen(RC_Im_BW,SE);
if RC_Im_BW==1
count=count+1;
end
end
figure;
imshow(afteropen,[])i write this code but i cant get number of rbc and this is my input image
clear all;
close all;
clc;
count=0;
RC_Im = imread(‘red_cells.png’);
RC_Im = rgb2gray(RC_Im);
level=graythresh(RC_Im);
RC_Im_BW = im2bw(RC_Im,level);
figure;
imshow(RC_Im_BW,[])
[x,z]=size(RC_Im_BW);
for R=0:1:60
SE = strel(‘disk’,R);
afteropen=imopen(RC_Im_BW,SE);
if RC_Im_BW==1
count=count+1;
end
end
figure;
imshow(afteropen,[]) i write this code but i cant get number of rbc and this is my input image
clear all;
close all;
clc;
count=0;
RC_Im = imread(‘red_cells.png’);
RC_Im = rgb2gray(RC_Im);
level=graythresh(RC_Im);
RC_Im_BW = im2bw(RC_Im,level);
figure;
imshow(RC_Im_BW,[])
[x,z]=size(RC_Im_BW);
for R=0:1:60
SE = strel(‘disk’,R);
afteropen=imopen(RC_Im_BW,SE);
if RC_Im_BW==1
count=count+1;
end
end
figure;
imshow(afteropen,[]) imopen, rbc, loop, se MATLAB Answers — New Questions
Fit a standard Exponential fit to approximate data
1. For every exponential shaped signals, I want to fit a standard exponential decay fit (I’ve drawn in black) by joining the possible points in the green line. Also I need the count of such fits in the plot along with the duration of each.
2. I want to find out the slope (I’ve drawn in violet colour with a question mark) by drawing a line (I’ve drawn in dark cyan) that connects the starting and ending point of the standard fit. How to do?
Herewith I’ve attached the excel sheet and the code that i’ve tried so far.
clc; close all; clear all;
a=readtable(‘Data.xlsx’);
time=a{2:40000,1};amplitude=a{2:40000,3};
max_peak_values = [];
max_peak_locs = [];
window_size = 1000;
for i = 1:window_size:length(amplitude)
end_index = min(i + window_size – 1, length(amplitude));
segment = amplitude(i:end_index);
[max_peak, loc] = max(segment);
max_peak_values = [max_peak_values; max_peak];
max_peak_locs = [max_peak_locs; loc + i – 1];
end
joined_signal = zeros(size(amplitude));
joined_signal(max_peak_locs) = max_peak_values;
for j = 1:length(max_peak_locs)-1
x = [max_peak_locs(j), max_peak_locs(j+1)];
y = [max_peak_values(j), max_peak_values(j+1)];
interp_x = x(1):x(2);
interp_y = linspace(y(1), y(2), length(interp_x));
joined_signal(interp_x) = interp_y;
end
figure;
plot(time, amplitude, ‘b’);
hold on; grid on
plot(time(max_peak_locs), max_peak_values, ‘ro’);
plot(time, joined_signal, ‘g’);1. For every exponential shaped signals, I want to fit a standard exponential decay fit (I’ve drawn in black) by joining the possible points in the green line. Also I need the count of such fits in the plot along with the duration of each.
2. I want to find out the slope (I’ve drawn in violet colour with a question mark) by drawing a line (I’ve drawn in dark cyan) that connects the starting and ending point of the standard fit. How to do?
Herewith I’ve attached the excel sheet and the code that i’ve tried so far.
clc; close all; clear all;
a=readtable(‘Data.xlsx’);
time=a{2:40000,1};amplitude=a{2:40000,3};
max_peak_values = [];
max_peak_locs = [];
window_size = 1000;
for i = 1:window_size:length(amplitude)
end_index = min(i + window_size – 1, length(amplitude));
segment = amplitude(i:end_index);
[max_peak, loc] = max(segment);
max_peak_values = [max_peak_values; max_peak];
max_peak_locs = [max_peak_locs; loc + i – 1];
end
joined_signal = zeros(size(amplitude));
joined_signal(max_peak_locs) = max_peak_values;
for j = 1:length(max_peak_locs)-1
x = [max_peak_locs(j), max_peak_locs(j+1)];
y = [max_peak_values(j), max_peak_values(j+1)];
interp_x = x(1):x(2);
interp_y = linspace(y(1), y(2), length(interp_x));
joined_signal(interp_x) = interp_y;
end
figure;
plot(time, amplitude, ‘b’);
hold on; grid on
plot(time(max_peak_locs), max_peak_values, ‘ro’);
plot(time, joined_signal, ‘g’); 1. For every exponential shaped signals, I want to fit a standard exponential decay fit (I’ve drawn in black) by joining the possible points in the green line. Also I need the count of such fits in the plot along with the duration of each.
2. I want to find out the slope (I’ve drawn in violet colour with a question mark) by drawing a line (I’ve drawn in dark cyan) that connects the starting and ending point of the standard fit. How to do?
Herewith I’ve attached the excel sheet and the code that i’ve tried so far.
clc; close all; clear all;
a=readtable(‘Data.xlsx’);
time=a{2:40000,1};amplitude=a{2:40000,3};
max_peak_values = [];
max_peak_locs = [];
window_size = 1000;
for i = 1:window_size:length(amplitude)
end_index = min(i + window_size – 1, length(amplitude));
segment = amplitude(i:end_index);
[max_peak, loc] = max(segment);
max_peak_values = [max_peak_values; max_peak];
max_peak_locs = [max_peak_locs; loc + i – 1];
end
joined_signal = zeros(size(amplitude));
joined_signal(max_peak_locs) = max_peak_values;
for j = 1:length(max_peak_locs)-1
x = [max_peak_locs(j), max_peak_locs(j+1)];
y = [max_peak_values(j), max_peak_values(j+1)];
interp_x = x(1):x(2);
interp_y = linspace(y(1), y(2), length(interp_x));
joined_signal(interp_x) = interp_y;
end
figure;
plot(time, amplitude, ‘b’);
hold on; grid on
plot(time(max_peak_locs), max_peak_values, ‘ro’);
plot(time, joined_signal, ‘g’); exponential fit MATLAB Answers — New Questions
Genetic Algorithm Custom Output
Hello, I’m trying to optimize a simple Simulink model output by using Genetic Algorithm. Three different output values are implemented in this model. The first one is used as cost value. Hovewer, the other two values are not assigned to anything. I want to get these outputs as timeseries after the Genetic Algorithm calculations, like "The second output of Generation XX Individual YY is …". When the calculations are done with single core, I can get all the results I want, but when the parallel toolbox is used, only the last generation and last individual is visible after the calculations. How can I fix that parallel calculation? Here is my simple code that gives all individuals and cost values for me, but I need the other two outputs of simulation. Thanks.
clear all;clc;,
%%
tic
saveFlag = 0;
rng(‘shuffle’);
objectiveFunction = @(params) nlaSimResults(params);
lowerBound = [1000 0.2];
upperBound = [25000 0.8];
popSize = 10;
genSize = 20;
options = optimoptions(‘ga’,’UseParallel’,true,’UseVectorized’,false,’PopulationSize’,popSize,’MaxGenerations’,genSize,’OutputFcn’,@gaOutputFunction,’Display’,’iter’);
[bestParams, minCost, ~, optResults, optPop, optScores] = ga(objectiveFunction,2,[],[],[],[],lowerBound,upperBound,[],options);
optimTime = toc;
if saveFlag == 1; save(‘OptimResulst’,’bestParams’,’minCost’,’optResults’,’optScores’,’optimTime’,’popSize’,’genSize’); end
function cost = nlaSimResults(params)
global otherVars
Altitude = params(1);
Mach = params(2);
assignin(‘base’,’Altitude’,Altitude);
assignin(‘base’,’Mach’,Mach);
sim(‘debugModel’,10); % Simulation Model with Altitude and Mach inputs
cost = logsout{1}.Values.Data(1); % The first output of the model is assigned as cost
if isempty(otherVars)
otherVars = {};
end
otherVars = [otherVars; logsout{2}.Values.Data logsout{3}.Values.Data];
assignin(‘base’,’otherVars’,otherVars);
end
function [state, options, flag] = gaOutputFunction(options, state, flag)
persistent popHistory bestValues bestIndividuals otherVarsHistory
global otherVars
if isempty(popHistory)
popHistory = {};
bestValues = [];
bestIndividuals = [];
otherVarsHistory = {};
end
[bestScore, bestIdx] = min(state.Score);
bestValues = [bestValues; bestScore];
bestIndividuals = [bestIndividuals; state.Population(bestIdx, :)];
popHistory(state.Generation + 1) = {state.Population};
otherVarsHistory{state.Generation + 1} = otherVars;
otherVars = [];
assignin(‘base’,’popHistory’,popHistory);
assignin(‘base’,’bestValues’,bestValues);
assignin(‘base’,’bestIndividuals’,bestIndividuals);
assignin(‘base’,’otherVarsHistory’,otherVarsHistory);
end
My model is so simple, just returning the sum, product and division of the altitude and mach values.Hello, I’m trying to optimize a simple Simulink model output by using Genetic Algorithm. Three different output values are implemented in this model. The first one is used as cost value. Hovewer, the other two values are not assigned to anything. I want to get these outputs as timeseries after the Genetic Algorithm calculations, like "The second output of Generation XX Individual YY is …". When the calculations are done with single core, I can get all the results I want, but when the parallel toolbox is used, only the last generation and last individual is visible after the calculations. How can I fix that parallel calculation? Here is my simple code that gives all individuals and cost values for me, but I need the other two outputs of simulation. Thanks.
clear all;clc;,
%%
tic
saveFlag = 0;
rng(‘shuffle’);
objectiveFunction = @(params) nlaSimResults(params);
lowerBound = [1000 0.2];
upperBound = [25000 0.8];
popSize = 10;
genSize = 20;
options = optimoptions(‘ga’,’UseParallel’,true,’UseVectorized’,false,’PopulationSize’,popSize,’MaxGenerations’,genSize,’OutputFcn’,@gaOutputFunction,’Display’,’iter’);
[bestParams, minCost, ~, optResults, optPop, optScores] = ga(objectiveFunction,2,[],[],[],[],lowerBound,upperBound,[],options);
optimTime = toc;
if saveFlag == 1; save(‘OptimResulst’,’bestParams’,’minCost’,’optResults’,’optScores’,’optimTime’,’popSize’,’genSize’); end
function cost = nlaSimResults(params)
global otherVars
Altitude = params(1);
Mach = params(2);
assignin(‘base’,’Altitude’,Altitude);
assignin(‘base’,’Mach’,Mach);
sim(‘debugModel’,10); % Simulation Model with Altitude and Mach inputs
cost = logsout{1}.Values.Data(1); % The first output of the model is assigned as cost
if isempty(otherVars)
otherVars = {};
end
otherVars = [otherVars; logsout{2}.Values.Data logsout{3}.Values.Data];
assignin(‘base’,’otherVars’,otherVars);
end
function [state, options, flag] = gaOutputFunction(options, state, flag)
persistent popHistory bestValues bestIndividuals otherVarsHistory
global otherVars
if isempty(popHistory)
popHistory = {};
bestValues = [];
bestIndividuals = [];
otherVarsHistory = {};
end
[bestScore, bestIdx] = min(state.Score);
bestValues = [bestValues; bestScore];
bestIndividuals = [bestIndividuals; state.Population(bestIdx, :)];
popHistory(state.Generation + 1) = {state.Population};
otherVarsHistory{state.Generation + 1} = otherVars;
otherVars = [];
assignin(‘base’,’popHistory’,popHistory);
assignin(‘base’,’bestValues’,bestValues);
assignin(‘base’,’bestIndividuals’,bestIndividuals);
assignin(‘base’,’otherVarsHistory’,otherVarsHistory);
end
My model is so simple, just returning the sum, product and division of the altitude and mach values. Hello, I’m trying to optimize a simple Simulink model output by using Genetic Algorithm. Three different output values are implemented in this model. The first one is used as cost value. Hovewer, the other two values are not assigned to anything. I want to get these outputs as timeseries after the Genetic Algorithm calculations, like "The second output of Generation XX Individual YY is …". When the calculations are done with single core, I can get all the results I want, but when the parallel toolbox is used, only the last generation and last individual is visible after the calculations. How can I fix that parallel calculation? Here is my simple code that gives all individuals and cost values for me, but I need the other two outputs of simulation. Thanks.
clear all;clc;,
%%
tic
saveFlag = 0;
rng(‘shuffle’);
objectiveFunction = @(params) nlaSimResults(params);
lowerBound = [1000 0.2];
upperBound = [25000 0.8];
popSize = 10;
genSize = 20;
options = optimoptions(‘ga’,’UseParallel’,true,’UseVectorized’,false,’PopulationSize’,popSize,’MaxGenerations’,genSize,’OutputFcn’,@gaOutputFunction,’Display’,’iter’);
[bestParams, minCost, ~, optResults, optPop, optScores] = ga(objectiveFunction,2,[],[],[],[],lowerBound,upperBound,[],options);
optimTime = toc;
if saveFlag == 1; save(‘OptimResulst’,’bestParams’,’minCost’,’optResults’,’optScores’,’optimTime’,’popSize’,’genSize’); end
function cost = nlaSimResults(params)
global otherVars
Altitude = params(1);
Mach = params(2);
assignin(‘base’,’Altitude’,Altitude);
assignin(‘base’,’Mach’,Mach);
sim(‘debugModel’,10); % Simulation Model with Altitude and Mach inputs
cost = logsout{1}.Values.Data(1); % The first output of the model is assigned as cost
if isempty(otherVars)
otherVars = {};
end
otherVars = [otherVars; logsout{2}.Values.Data logsout{3}.Values.Data];
assignin(‘base’,’otherVars’,otherVars);
end
function [state, options, flag] = gaOutputFunction(options, state, flag)
persistent popHistory bestValues bestIndividuals otherVarsHistory
global otherVars
if isempty(popHistory)
popHistory = {};
bestValues = [];
bestIndividuals = [];
otherVarsHistory = {};
end
[bestScore, bestIdx] = min(state.Score);
bestValues = [bestValues; bestScore];
bestIndividuals = [bestIndividuals; state.Population(bestIdx, :)];
popHistory(state.Generation + 1) = {state.Population};
otherVarsHistory{state.Generation + 1} = otherVars;
otherVars = [];
assignin(‘base’,’popHistory’,popHistory);
assignin(‘base’,’bestValues’,bestValues);
assignin(‘base’,’bestIndividuals’,bestIndividuals);
assignin(‘base’,’otherVarsHistory’,otherVarsHistory);
end
My model is so simple, just returning the sum, product and division of the altitude and mach values. genetic algorithm, parallel computing toolbox MATLAB Answers — New Questions