Tag Archives: matlab
start app by doubleclicking mat-file with custom extension
An application which was greated using GUIDE can save *.mat files with a cusom extension, like *.MyExtension. What I want is, that I doubleclick in the windows explorer such a file, which will:
1. open my application (probably some settings in windows)
2. pass the file path to the application, so that the data can be loaded. Can someone help me on this?An application which was greated using GUIDE can save *.mat files with a cusom extension, like *.MyExtension. What I want is, that I doubleclick in the windows explorer such a file, which will:
1. open my application (probably some settings in windows)
2. pass the file path to the application, so that the data can be loaded. Can someone help me on this? An application which was greated using GUIDE can save *.mat files with a cusom extension, like *.MyExtension. What I want is, that I doubleclick in the windows explorer such a file, which will:
1. open my application (probably some settings in windows)
2. pass the file path to the application, so that the data can be loaded. Can someone help me on this? load file in application MATLAB Answers — New Questions
Performing 2D convolution
Hello,
I am new to image processing and had a conceptual question. I am currently trying to perform a 2D convolution of an image and a kernel (filter) in simulink using the 2D convolution block. I have code that transposes the image, then flips it, then performs the 2D convolution with the kernel. However from my (very limited) understanding convolution already flips the filter that I want to apply. I was told that the output of me transposing and flipping the image, then convolving with the kernel looks correct, however from my understanding I would be transposing and flipping the image once then convolving, which involves another flip, so therefore not actually convolving? I have read that this would just produce instead a correlation?
Hoping someone who knows more may be able to help give me a better understanding.
Thank you!Hello,
I am new to image processing and had a conceptual question. I am currently trying to perform a 2D convolution of an image and a kernel (filter) in simulink using the 2D convolution block. I have code that transposes the image, then flips it, then performs the 2D convolution with the kernel. However from my (very limited) understanding convolution already flips the filter that I want to apply. I was told that the output of me transposing and flipping the image, then convolving with the kernel looks correct, however from my understanding I would be transposing and flipping the image once then convolving, which involves another flip, so therefore not actually convolving? I have read that this would just produce instead a correlation?
Hoping someone who knows more may be able to help give me a better understanding.
Thank you! Hello,
I am new to image processing and had a conceptual question. I am currently trying to perform a 2D convolution of an image and a kernel (filter) in simulink using the 2D convolution block. I have code that transposes the image, then flips it, then performs the 2D convolution with the kernel. However from my (very limited) understanding convolution already flips the filter that I want to apply. I was told that the output of me transposing and flipping the image, then convolving with the kernel looks correct, however from my understanding I would be transposing and flipping the image once then convolving, which involves another flip, so therefore not actually convolving? I have read that this would just produce instead a correlation?
Hoping someone who knows more may be able to help give me a better understanding.
Thank you! convolution, simulink, image processing MATLAB Answers — New Questions
Problem on startup. MacMini M4, Sequoia 15.6.1
On starup I get this meggage:
Ubable yo communicate with required MathWorks services (error 201)
Any ideas?On starup I get this meggage:
Ubable yo communicate with required MathWorks services (error 201)
Any ideas? On starup I get this meggage:
Ubable yo communicate with required MathWorks services (error 201)
Any ideas? jon’s q MATLAB Answers — New Questions
Why am I not getting printed all zones and info from one column in my table?
Here are the steps that lead to the results:
1) You start by running app2_tester that leads to app3_tester ( for making the problem simpler, I have just made it possible choosing just one combination of salts, NaCl KCl and ZnBr2: so that I don’t need to attach many function files, though there are listed up many salts in the listbox of app3_tester.
2) Each time you have pressed the choices for every zone, you press the button “done with the zone”, for instance when you in start have chosen that there are two zones, you first begin to selecting information for zone1 then do the same for zone 2
3) When you have finished pressing info about both zones, you press “ computed water activity and osmotic pressure” in app2_tester
I have problems in app2_tester and app3_tester. The other apps and some functions that are needed to run the apps are correct. I get error in app3_tester. So what I am wondering is:
Why am I not getting the zone nr 2 writtten in my osmotic table data that is printed out when I press on the button “display results from all zones”, and neither the names of the different combinations of salts in the column called combination_of_salts in my table?
The error I get says:
Error using table (line 231)
All input variables must have the same number of rows.
Error in app3_tester/StartanalysisButtonPushed (line 259)
app.Callingapp.Osmotisk_data(app.zone_now,:) = table(app.zone_now, app.combinations_of_salts, app.vekt_prosent_best_salt_1,app.vekt_prosent_best_salt_2, app.samlet_vannaktivitet,P,effect);Here are the steps that lead to the results:
1) You start by running app2_tester that leads to app3_tester ( for making the problem simpler, I have just made it possible choosing just one combination of salts, NaCl KCl and ZnBr2: so that I don’t need to attach many function files, though there are listed up many salts in the listbox of app3_tester.
2) Each time you have pressed the choices for every zone, you press the button “done with the zone”, for instance when you in start have chosen that there are two zones, you first begin to selecting information for zone1 then do the same for zone 2
3) When you have finished pressing info about both zones, you press “ computed water activity and osmotic pressure” in app2_tester
I have problems in app2_tester and app3_tester. The other apps and some functions that are needed to run the apps are correct. I get error in app3_tester. So what I am wondering is:
Why am I not getting the zone nr 2 writtten in my osmotic table data that is printed out when I press on the button “display results from all zones”, and neither the names of the different combinations of salts in the column called combination_of_salts in my table?
The error I get says:
Error using table (line 231)
All input variables must have the same number of rows.
Error in app3_tester/StartanalysisButtonPushed (line 259)
app.Callingapp.Osmotisk_data(app.zone_now,:) = table(app.zone_now, app.combinations_of_salts, app.vekt_prosent_best_salt_1,app.vekt_prosent_best_salt_2, app.samlet_vannaktivitet,P,effect); Here are the steps that lead to the results:
1) You start by running app2_tester that leads to app3_tester ( for making the problem simpler, I have just made it possible choosing just one combination of salts, NaCl KCl and ZnBr2: so that I don’t need to attach many function files, though there are listed up many salts in the listbox of app3_tester.
2) Each time you have pressed the choices for every zone, you press the button “done with the zone”, for instance when you in start have chosen that there are two zones, you first begin to selecting information for zone1 then do the same for zone 2
3) When you have finished pressing info about both zones, you press “ computed water activity and osmotic pressure” in app2_tester
I have problems in app2_tester and app3_tester. The other apps and some functions that are needed to run the apps are correct. I get error in app3_tester. So what I am wondering is:
Why am I not getting the zone nr 2 writtten in my osmotic table data that is printed out when I press on the button “display results from all zones”, and neither the names of the different combinations of salts in the column called combination_of_salts in my table?
The error I get says:
Error using table (line 231)
All input variables must have the same number of rows.
Error in app3_tester/StartanalysisButtonPushed (line 259)
app.Callingapp.Osmotisk_data(app.zone_now,:) = table(app.zone_now, app.combinations_of_salts, app.vekt_prosent_best_salt_1,app.vekt_prosent_best_salt_2, app.samlet_vannaktivitet,P,effect); appdesigner, table MATLAB Answers — New Questions
What is the fastest way to swap large blocks of data between RAM and disk storage?
Hi all. I need to work with 4 large matrix variables repeatedly in sequence. But only one of them can fit in RAM at a time. (70 GB each, 128 GB of RAM). The operations are time-sensitive, so I need to be able to load one block of data, do some computations, release the memory, load the next block…and so on, as fast as possible. I have been looking at data store & tall arrays — I could concatenate the 4 into one tall array — but that seems intended for operations that have to span more rows than memory can hold, like taking a max across all of them. Here I just need access to one contiguous block that -will- all fit in memory, but to cycle through multiple of them. What is the preferred approach? I am using the parallel processing toolbox, but am not sure how to apply parallelization to this issue in a way that doesn’t just add more overhead. Currently I save data into uncompressed v7.3 .mat files, but I can convert to whatever helps. Thanks in advance for your insights!Hi all. I need to work with 4 large matrix variables repeatedly in sequence. But only one of them can fit in RAM at a time. (70 GB each, 128 GB of RAM). The operations are time-sensitive, so I need to be able to load one block of data, do some computations, release the memory, load the next block…and so on, as fast as possible. I have been looking at data store & tall arrays — I could concatenate the 4 into one tall array — but that seems intended for operations that have to span more rows than memory can hold, like taking a max across all of them. Here I just need access to one contiguous block that -will- all fit in memory, but to cycle through multiple of them. What is the preferred approach? I am using the parallel processing toolbox, but am not sure how to apply parallelization to this issue in a way that doesn’t just add more overhead. Currently I save data into uncompressed v7.3 .mat files, but I can convert to whatever helps. Thanks in advance for your insights! Hi all. I need to work with 4 large matrix variables repeatedly in sequence. But only one of them can fit in RAM at a time. (70 GB each, 128 GB of RAM). The operations are time-sensitive, so I need to be able to load one block of data, do some computations, release the memory, load the next block…and so on, as fast as possible. I have been looking at data store & tall arrays — I could concatenate the 4 into one tall array — but that seems intended for operations that have to span more rows than memory can hold, like taking a max across all of them. Here I just need access to one contiguous block that -will- all fit in memory, but to cycle through multiple of them. What is the preferred approach? I am using the parallel processing toolbox, but am not sure how to apply parallelization to this issue in a way that doesn’t just add more overhead. Currently I save data into uncompressed v7.3 .mat files, but I can convert to whatever helps. Thanks in advance for your insights! memory management, tall arrays MATLAB Answers — New Questions
Issues with the quality difference between plots created in live script and normal script or command window.
Hey there, recently I’ve updated from 2024b to 2025a and immediately the thing that grabbed my attention was the fact that plots created in live editor and command window are vastly different in resolution and smoothness. I’ve tried searching for people with similar experience in Matlab answers but couldn’t find anything related. Some had issues with the gpu or renderer but my problem is only happening in live editor.
Here’s a comparison between a plot created in two environments:
clear; close; clc
t = linspace(0, 2*pi, 1000);
f = 4;
y = 0.8*sin(2*pi*f*t);
figure
plot(t, y)
axis tight
Lower res from live editor:
Higher res from work space:
I’ve also attached the plots incase uploding them corrupts the quality.
Now the interesting thing is that when I open up the figure window of the same plot that I had created in live editor then suddenly the quality is high again. I tried my luck with chat gpt and grok but they were pulling their results from the same forums that I had already visited so nothing useful was found that way.Hey there, recently I’ve updated from 2024b to 2025a and immediately the thing that grabbed my attention was the fact that plots created in live editor and command window are vastly different in resolution and smoothness. I’ve tried searching for people with similar experience in Matlab answers but couldn’t find anything related. Some had issues with the gpu or renderer but my problem is only happening in live editor.
Here’s a comparison between a plot created in two environments:
clear; close; clc
t = linspace(0, 2*pi, 1000);
f = 4;
y = 0.8*sin(2*pi*f*t);
figure
plot(t, y)
axis tight
Lower res from live editor:
Higher res from work space:
I’ve also attached the plots incase uploding them corrupts the quality.
Now the interesting thing is that when I open up the figure window of the same plot that I had created in live editor then suddenly the quality is high again. I tried my luck with chat gpt and grok but they were pulling their results from the same forums that I had already visited so nothing useful was found that way. Hey there, recently I’ve updated from 2024b to 2025a and immediately the thing that grabbed my attention was the fact that plots created in live editor and command window are vastly different in resolution and smoothness. I’ve tried searching for people with similar experience in Matlab answers but couldn’t find anything related. Some had issues with the gpu or renderer but my problem is only happening in live editor.
Here’s a comparison between a plot created in two environments:
clear; close; clc
t = linspace(0, 2*pi, 1000);
f = 4;
y = 0.8*sin(2*pi*f*t);
figure
plot(t, y)
axis tight
Lower res from live editor:
Higher res from work space:
I’ve also attached the plots incase uploding them corrupts the quality.
Now the interesting thing is that when I open up the figure window of the same plot that I had created in live editor then suddenly the quality is high again. I tried my luck with chat gpt and grok but they were pulling their results from the same forums that I had already visited so nothing useful was found that way. low resolution plot, live editor MATLAB Answers — New Questions
How to force Embedded coder to use a specific struct name (instead of struct_xxxxxx) for system object parameters?
I have a custom System object that uses a configuration struct returned by a helper function:
classdef Demo_setpoint_adjuster < matlab.System
properties
config = Demo.getconfig;
end
methods
function obj = Demo_setpoint_adjuster()
% Optionally initialize config/state here if needed
end
end
methods(Access = protected)
function [adjusted_setpoint] = stepImpl(obj, setpoint)
% Default passthrough implementation
% Assign outputs
adjusted_setpoint = setpoint * obj.config.gain;
% TODO implement
end
function num = getNumInputsImpl(~), num = 1; end
function varargout = getNumOutputsImpl(~), varargout = {1, []}; end
function varargout = getOutputSizeImpl(~), varargout = {1}; end
function varargout = getOutputDataTypeImpl(~), varargout = {‘double’}; end
function varargout = isOutputComplexImpl(~), varargout = {false}; end
function varargout = isOutputFixedSizeImpl(~), varargout = {true}; end
end
end
My getconfig function looks like this:
function cfg = getconfig(varargin)
cfg = Simulink.Bus.createMATLABStruct(‘DEMO_config_def’);
cfg.gain = 10;
cfg.offset = 1e-13;
coder.cstructname(cfg, ‘my_struct’);
end % end of main function getconfig
When I generate code with Embedded coder, the header file defines the parameter type as something like:
typedef struct {
real_T gain;
real_T offset;
} struct_6h72eH5WFuEIyQr5YrdGuB;
Instead of my desired:
typedef struct {
real_T gain;
real_T offset;
} my_struct;
Even though I use coder.cstructname, Simulink still generates the anonymous struct_xxxxxx
Question:
When using a System object parameter inside a simulink model, how can i ensure embedded coder generates a struct with a specific typedef name (e.g., my_struct)? Is the recommended approach to use Simulink.Bus/Simulink.Parameter, or can coder.cstructname be applied directly in this workflow?I have a custom System object that uses a configuration struct returned by a helper function:
classdef Demo_setpoint_adjuster < matlab.System
properties
config = Demo.getconfig;
end
methods
function obj = Demo_setpoint_adjuster()
% Optionally initialize config/state here if needed
end
end
methods(Access = protected)
function [adjusted_setpoint] = stepImpl(obj, setpoint)
% Default passthrough implementation
% Assign outputs
adjusted_setpoint = setpoint * obj.config.gain;
% TODO implement
end
function num = getNumInputsImpl(~), num = 1; end
function varargout = getNumOutputsImpl(~), varargout = {1, []}; end
function varargout = getOutputSizeImpl(~), varargout = {1}; end
function varargout = getOutputDataTypeImpl(~), varargout = {‘double’}; end
function varargout = isOutputComplexImpl(~), varargout = {false}; end
function varargout = isOutputFixedSizeImpl(~), varargout = {true}; end
end
end
My getconfig function looks like this:
function cfg = getconfig(varargin)
cfg = Simulink.Bus.createMATLABStruct(‘DEMO_config_def’);
cfg.gain = 10;
cfg.offset = 1e-13;
coder.cstructname(cfg, ‘my_struct’);
end % end of main function getconfig
When I generate code with Embedded coder, the header file defines the parameter type as something like:
typedef struct {
real_T gain;
real_T offset;
} struct_6h72eH5WFuEIyQr5YrdGuB;
Instead of my desired:
typedef struct {
real_T gain;
real_T offset;
} my_struct;
Even though I use coder.cstructname, Simulink still generates the anonymous struct_xxxxxx
Question:
When using a System object parameter inside a simulink model, how can i ensure embedded coder generates a struct with a specific typedef name (e.g., my_struct)? Is the recommended approach to use Simulink.Bus/Simulink.Parameter, or can coder.cstructname be applied directly in this workflow? I have a custom System object that uses a configuration struct returned by a helper function:
classdef Demo_setpoint_adjuster < matlab.System
properties
config = Demo.getconfig;
end
methods
function obj = Demo_setpoint_adjuster()
% Optionally initialize config/state here if needed
end
end
methods(Access = protected)
function [adjusted_setpoint] = stepImpl(obj, setpoint)
% Default passthrough implementation
% Assign outputs
adjusted_setpoint = setpoint * obj.config.gain;
% TODO implement
end
function num = getNumInputsImpl(~), num = 1; end
function varargout = getNumOutputsImpl(~), varargout = {1, []}; end
function varargout = getOutputSizeImpl(~), varargout = {1}; end
function varargout = getOutputDataTypeImpl(~), varargout = {‘double’}; end
function varargout = isOutputComplexImpl(~), varargout = {false}; end
function varargout = isOutputFixedSizeImpl(~), varargout = {true}; end
end
end
My getconfig function looks like this:
function cfg = getconfig(varargin)
cfg = Simulink.Bus.createMATLABStruct(‘DEMO_config_def’);
cfg.gain = 10;
cfg.offset = 1e-13;
coder.cstructname(cfg, ‘my_struct’);
end % end of main function getconfig
When I generate code with Embedded coder, the header file defines the parameter type as something like:
typedef struct {
real_T gain;
real_T offset;
} struct_6h72eH5WFuEIyQr5YrdGuB;
Instead of my desired:
typedef struct {
real_T gain;
real_T offset;
} my_struct;
Even though I use coder.cstructname, Simulink still generates the anonymous struct_xxxxxx
Question:
When using a System object parameter inside a simulink model, how can i ensure embedded coder generates a struct with a specific typedef name (e.g., my_struct)? Is the recommended approach to use Simulink.Bus/Simulink.Parameter, or can coder.cstructname be applied directly in this workflow? embedded coder MATLAB Answers — New Questions
How do I implement a script using system objects?
Hello, I am new to Simulink so please go easy on me. I am trying to implement this particular example using system objects from the related toolboxes.
https://www.mathworks.com/help/phased/ug/integrated-sensing-and-communication-2-communication-centric-approach-using-mimo-ofdm.html
I have tried using different transmitters available but it does not seem to work. Any idea to create the Tx/Rx arras and set their locations? Thanks.Hello, I am new to Simulink so please go easy on me. I am trying to implement this particular example using system objects from the related toolboxes.
https://www.mathworks.com/help/phased/ug/integrated-sensing-and-communication-2-communication-centric-approach-using-mimo-ofdm.html
I have tried using different transmitters available but it does not seem to work. Any idea to create the Tx/Rx arras and set their locations? Thanks. Hello, I am new to Simulink so please go easy on me. I am trying to implement this particular example using system objects from the related toolboxes.
https://www.mathworks.com/help/phased/ug/integrated-sensing-and-communication-2-communication-centric-approach-using-mimo-ofdm.html
I have tried using different transmitters available but it does not seem to work. Any idea to create the Tx/Rx arras and set their locations? Thanks. simulink, phased array MATLAB Answers — New Questions
How to correctly find the solution of a system of equations containing trigonometric functions
theta=70;L=1500;h=200;D=1;
eq=[l1+l2==L;
(cosd(theta)*cosd(x1)-sind(theta)*sind(x1))/x==cosd(x1)/l2;
(cosd(theta)*cosd(x1)+sind(theta)*sind(x1))/x==cosd(x1)/l1;
tand(x1)==D/(2*f);tand(x1)==x/y;cosd(theta)==h/(y+f)];
vars=[x1,l1,l2,f,x,y];
[x1,l1,l2,f,x,y]=solve(eq,vars)
The code is as above,the solution show
l1 =
7590603.4479823424160756070250191
l2 =
-7587603.8886555868349951502850662,I think the solution is wrong,but I don’t know what is wrong,Can anyone fix this?theta=70;L=1500;h=200;D=1;
eq=[l1+l2==L;
(cosd(theta)*cosd(x1)-sind(theta)*sind(x1))/x==cosd(x1)/l2;
(cosd(theta)*cosd(x1)+sind(theta)*sind(x1))/x==cosd(x1)/l1;
tand(x1)==D/(2*f);tand(x1)==x/y;cosd(theta)==h/(y+f)];
vars=[x1,l1,l2,f,x,y];
[x1,l1,l2,f,x,y]=solve(eq,vars)
The code is as above,the solution show
l1 =
7590603.4479823424160756070250191
l2 =
-7587603.8886555868349951502850662,I think the solution is wrong,but I don’t know what is wrong,Can anyone fix this? theta=70;L=1500;h=200;D=1;
eq=[l1+l2==L;
(cosd(theta)*cosd(x1)-sind(theta)*sind(x1))/x==cosd(x1)/l2;
(cosd(theta)*cosd(x1)+sind(theta)*sind(x1))/x==cosd(x1)/l1;
tand(x1)==D/(2*f);tand(x1)==x/y;cosd(theta)==h/(y+f)];
vars=[x1,l1,l2,f,x,y];
[x1,l1,l2,f,x,y]=solve(eq,vars)
The code is as above,the solution show
l1 =
7590603.4479823424160756070250191
l2 =
-7587603.8886555868349951502850662,I think the solution is wrong,but I don’t know what is wrong,Can anyone fix this? trigonometric functions;, equations MATLAB Answers — New Questions
How to keep Host ID from changing on Linux
I am currently on a trial of matlab and my host ID changes upon completely random circumstances, I can have consequtive launches with no problem then suddenly it says my hwid is mismatched, happened once when I installed new desktop to get dark mode, then just randomly a few times. I am on Arch, what could be causing this? It’s not like it changes every other launch either
> matlab
MATLAB is selecting SOFTWARE rendering.
License checkout failed.
License Manager Error -9
Host ID ‘125e69df2eff’ in the license file does not match your computer’s host ID: "1643c734f6fd f02f741d5011 f02f741d4fb4".
To resolve this issue, reactivate your license.
Troubleshoot this issue by visiting:
https://www.mathworks.com/support/lme/9
Diagnostic Information:
Feature: MATLAB
License path: /home/ciel/.matlab/R2024b_licenses:/home/ciel/MATLAB/2024B/licenses/license.dat:/home/ciel/MATLAB/2024B/licenses/trial_12942131_R2024b.lic
Licensing error: -9,57.
Unable to launch MVM server: License Error: Licensing shutdown
> ./MATLAB/2024B/bin/glnxa64/MathWorksProductAuthorizer
> matlab
MATLAB is selecting SOFTWARE rendering.
> matlab -nosoftwareopengl
License checkout failed.
License Manager Error -9
Host ID ‘1643c734f6fd’ in the license file does not match your computer’s host ID: "2652814a85c3 f02f741d5011 f02f741d4fb4".
To resolve this issue, reactivate your license.
Troubleshoot this issue by visiting:
https://www.mathworks.com/support/lme/9
Diagnostic Information:
Feature: MATLAB
License path: /home/ciel/.matlab/R2024b_licenses:/home/ciel/MATLAB/2024B/licenses/license.dat:/home/ciel/MATLAB/2024B/licenses/trial_12942131_R2024b.lic
Licensing error: -9,57.
Unable to launch MVM server: License Error: Licensing shutdown
> ./MATLAB/2024B/bin/glnxa64/MathWorksProductAuthorizer
> matlab -nosoftwareopengl
> matlab
This is all within one single terminal session, and a few more has happened before this, what do I do?I am currently on a trial of matlab and my host ID changes upon completely random circumstances, I can have consequtive launches with no problem then suddenly it says my hwid is mismatched, happened once when I installed new desktop to get dark mode, then just randomly a few times. I am on Arch, what could be causing this? It’s not like it changes every other launch either
> matlab
MATLAB is selecting SOFTWARE rendering.
License checkout failed.
License Manager Error -9
Host ID ‘125e69df2eff’ in the license file does not match your computer’s host ID: "1643c734f6fd f02f741d5011 f02f741d4fb4".
To resolve this issue, reactivate your license.
Troubleshoot this issue by visiting:
https://www.mathworks.com/support/lme/9
Diagnostic Information:
Feature: MATLAB
License path: /home/ciel/.matlab/R2024b_licenses:/home/ciel/MATLAB/2024B/licenses/license.dat:/home/ciel/MATLAB/2024B/licenses/trial_12942131_R2024b.lic
Licensing error: -9,57.
Unable to launch MVM server: License Error: Licensing shutdown
> ./MATLAB/2024B/bin/glnxa64/MathWorksProductAuthorizer
> matlab
MATLAB is selecting SOFTWARE rendering.
> matlab -nosoftwareopengl
License checkout failed.
License Manager Error -9
Host ID ‘1643c734f6fd’ in the license file does not match your computer’s host ID: "2652814a85c3 f02f741d5011 f02f741d4fb4".
To resolve this issue, reactivate your license.
Troubleshoot this issue by visiting:
https://www.mathworks.com/support/lme/9
Diagnostic Information:
Feature: MATLAB
License path: /home/ciel/.matlab/R2024b_licenses:/home/ciel/MATLAB/2024B/licenses/license.dat:/home/ciel/MATLAB/2024B/licenses/trial_12942131_R2024b.lic
Licensing error: -9,57.
Unable to launch MVM server: License Error: Licensing shutdown
> ./MATLAB/2024B/bin/glnxa64/MathWorksProductAuthorizer
> matlab -nosoftwareopengl
> matlab
This is all within one single terminal session, and a few more has happened before this, what do I do? I am currently on a trial of matlab and my host ID changes upon completely random circumstances, I can have consequtive launches with no problem then suddenly it says my hwid is mismatched, happened once when I installed new desktop to get dark mode, then just randomly a few times. I am on Arch, what could be causing this? It’s not like it changes every other launch either
> matlab
MATLAB is selecting SOFTWARE rendering.
License checkout failed.
License Manager Error -9
Host ID ‘125e69df2eff’ in the license file does not match your computer’s host ID: "1643c734f6fd f02f741d5011 f02f741d4fb4".
To resolve this issue, reactivate your license.
Troubleshoot this issue by visiting:
https://www.mathworks.com/support/lme/9
Diagnostic Information:
Feature: MATLAB
License path: /home/ciel/.matlab/R2024b_licenses:/home/ciel/MATLAB/2024B/licenses/license.dat:/home/ciel/MATLAB/2024B/licenses/trial_12942131_R2024b.lic
Licensing error: -9,57.
Unable to launch MVM server: License Error: Licensing shutdown
> ./MATLAB/2024B/bin/glnxa64/MathWorksProductAuthorizer
> matlab
MATLAB is selecting SOFTWARE rendering.
> matlab -nosoftwareopengl
License checkout failed.
License Manager Error -9
Host ID ‘1643c734f6fd’ in the license file does not match your computer’s host ID: "2652814a85c3 f02f741d5011 f02f741d4fb4".
To resolve this issue, reactivate your license.
Troubleshoot this issue by visiting:
https://www.mathworks.com/support/lme/9
Diagnostic Information:
Feature: MATLAB
License path: /home/ciel/.matlab/R2024b_licenses:/home/ciel/MATLAB/2024B/licenses/license.dat:/home/ciel/MATLAB/2024B/licenses/trial_12942131_R2024b.lic
Licensing error: -9,57.
Unable to launch MVM server: License Error: Licensing shutdown
> ./MATLAB/2024B/bin/glnxa64/MathWorksProductAuthorizer
> matlab -nosoftwareopengl
> matlab
This is all within one single terminal session, and a few more has happened before this, what do I do? installataion, licensing, host id MATLAB Answers — New Questions
Error using Git source control with Simulink
I’m using MATLAB 2023a and Git for a Simulink Project (.prj). The project contains a "main" Simulink model that references several other models using Model Reference blocks. Most of these models also have test harnesses.
When I try to compare my model against its ancestor (or any Git revision), I get the following error pop-up:
Cannot open test harness ‘name-of-test’ as another model with the same name is currently open. Please close the other model before opening this harness
Additionaly, when comparing the "main" model, the comparison results show only changes in test harnesses but no differences in the actual model itself.
Important notes:
I am not editing the test harness
I don’t have any harness open during the comparison
Has anyone run into this behaviour? Is there a way to configure MATLAB/Simulink (or Git) to ignore test harness models during comparison so that only actual model changes are shown?I’m using MATLAB 2023a and Git for a Simulink Project (.prj). The project contains a "main" Simulink model that references several other models using Model Reference blocks. Most of these models also have test harnesses.
When I try to compare my model against its ancestor (or any Git revision), I get the following error pop-up:
Cannot open test harness ‘name-of-test’ as another model with the same name is currently open. Please close the other model before opening this harness
Additionaly, when comparing the "main" model, the comparison results show only changes in test harnesses but no differences in the actual model itself.
Important notes:
I am not editing the test harness
I don’t have any harness open during the comparison
Has anyone run into this behaviour? Is there a way to configure MATLAB/Simulink (or Git) to ignore test harness models during comparison so that only actual model changes are shown? I’m using MATLAB 2023a and Git for a Simulink Project (.prj). The project contains a "main" Simulink model that references several other models using Model Reference blocks. Most of these models also have test harnesses.
When I try to compare my model against its ancestor (or any Git revision), I get the following error pop-up:
Cannot open test harness ‘name-of-test’ as another model with the same name is currently open. Please close the other model before opening this harness
Additionaly, when comparing the "main" model, the comparison results show only changes in test harnesses but no differences in the actual model itself.
Important notes:
I am not editing the test harness
I don’t have any harness open during the comparison
Has anyone run into this behaviour? Is there a way to configure MATLAB/Simulink (or Git) to ignore test harness models during comparison so that only actual model changes are shown? test harness, git, source control MATLAB Answers — New Questions
Change color of diagonal bars (1,1), (2,2), (3,3)… in bar3
I am plotting a 2D histogram where there are 7 bars in each axis. An example of the data is attached as N.
On this plot, I would like to be able to color the diagonal bars [e.g., (1,1), (2,2) … (7,7)] green, while leaving the rest of the bars the the base color.
I’ve built the chart using:
[N, Xedges, Yedges] = histcounts2(Xvals, yVals, [7, 7]);
h = bar3(N);
And I’m trying to color the bars using something like this, but I can’t seem to figure out how to select the only the kth bar in each row:
for k = 1 : length(h) % operate on each row of bars
% Set FaceColor to ‘flat’ to use CData for coloring
h(k).FaceColor = ‘flat’;
set(h(k),’facecolor’,[0 1 0]) % green
end
Ideally, I’d like to color both the top and sides of the selected bars green.I am plotting a 2D histogram where there are 7 bars in each axis. An example of the data is attached as N.
On this plot, I would like to be able to color the diagonal bars [e.g., (1,1), (2,2) … (7,7)] green, while leaving the rest of the bars the the base color.
I’ve built the chart using:
[N, Xedges, Yedges] = histcounts2(Xvals, yVals, [7, 7]);
h = bar3(N);
And I’m trying to color the bars using something like this, but I can’t seem to figure out how to select the only the kth bar in each row:
for k = 1 : length(h) % operate on each row of bars
% Set FaceColor to ‘flat’ to use CData for coloring
h(k).FaceColor = ‘flat’;
set(h(k),’facecolor’,[0 1 0]) % green
end
Ideally, I’d like to color both the top and sides of the selected bars green. I am plotting a 2D histogram where there are 7 bars in each axis. An example of the data is attached as N.
On this plot, I would like to be able to color the diagonal bars [e.g., (1,1), (2,2) … (7,7)] green, while leaving the rest of the bars the the base color.
I’ve built the chart using:
[N, Xedges, Yedges] = histcounts2(Xvals, yVals, [7, 7]);
h = bar3(N);
And I’m trying to color the bars using something like this, but I can’t seem to figure out how to select the only the kth bar in each row:
for k = 1 : length(h) % operate on each row of bars
% Set FaceColor to ‘flat’ to use CData for coloring
h(k).FaceColor = ‘flat’;
set(h(k),’facecolor’,[0 1 0]) % green
end
Ideally, I’d like to color both the top and sides of the selected bars green. bar3, color specific bars, handles MATLAB Answers — New Questions
Supressing Live Script plotting figure inline
I am plotting a figure from a Live Script using the
set(gcf, ‘Visible’, ‘on’);
option to make it appear in a separate, external window.
However, a copy of the figure still appears inline the Live Script and I could not find a way to avoid it.
The figure should only appear externally (i.e. in a separate window, which it already does), and not get created inline too.I am plotting a figure from a Live Script using the
set(gcf, ‘Visible’, ‘on’);
option to make it appear in a separate, external window.
However, a copy of the figure still appears inline the Live Script and I could not find a way to avoid it.
The figure should only appear externally (i.e. in a separate window, which it already does), and not get created inline too. I am plotting a figure from a Live Script using the
set(gcf, ‘Visible’, ‘on’);
option to make it appear in a separate, external window.
However, a copy of the figure still appears inline the Live Script and I could not find a way to avoid it.
The figure should only appear externally (i.e. in a separate window, which it already does), and not get created inline too. live script, figure, plot, window MATLAB Answers — New Questions
why exportgraphics fails to print the legend when the content type is vector and the legend is latex interpreted?
when exporting a fig as a vector, e.g. eps or pdf, if the legend is latex interpreted, the exported graphics do not show the legend. Below a snippet of my code:
% Figure
if showFig
f = figure(‘Color’,’w’);
else
f = figure(‘Visible’,’off’,’Color’,’w’);
end
hold on; grid on; box on; set(gca,’YScale’,’log’);
cols = lines(9);
% Plot ML refined (solid) and CRB/PEB (dashed, black markers)
% Case A
p1 = semilogy(x, RMSE_A, ‘-o’, ‘Color’, cols(1,:), ‘LineWidth’, 1.8, ‘MarkerSize’, 6);
p2 = semilogy(x, PEB_A, ‘–o’, ‘Color’, [0 0 0], ‘LineWidth’, 1.3, ‘MarkerSize’, 5);
% Case B
p3 = semilogy(x, RMSE_B, ‘-s’, ‘Color’, cols(2,:), ‘LineWidth’, 1.8, ‘MarkerSize’, 6);
p4 = semilogy(x, PEB_B, ‘–s’, ‘Color’, [0 0 0], ‘LineWidth’, 1.3, ‘MarkerSize’, 5);
% Case C
p5 = semilogy(x, RMSE_C, ‘-^’, ‘Color’, cols(3,:), ‘LineWidth’, 1.8, ‘MarkerSize’, 6);
p6 = semilogy(x, PEB_C, ‘–^’, ‘Color’, [0 0 0], ‘LineWidth’, 1.3, ‘MarkerSize’, 5);
semilogy(R.values, 20*ones(size(R.values)),’:r’,’LineWidth’,1.8);
xlim([min(x) max(x)])
legend([p1 p2 p3 p4 p5 p6], …
{‘ML RMSE_A’,’PEB_A’,’ML RMSE_B’,’PEB_B’,’ML RMSE_C’,’PEB_C’}, …
‘Location’,’best’,’Interpreter’,’latex’);
xlabel(xlab, ‘Interpreter’,’latex’);
ylabel(‘RMSE / PEB [mm]’, ‘Interpreter’,’latex’);
title(run_title, ‘Interpreter’,’none’);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,18,’LineWidth’,1.2);
% EXPORT FIG
drawnow; % ensure legend is drawn
set(f, ‘Renderer’, ‘painters’); % force vector renderer
set(f, ‘PaperPositionMode’,’auto’); % match figure size
[~, base, ~] = fileparts(mat_path);
out_path = fullfile(files(i).folder, sprintf(‘%s_PEB_ML.%s’, base, fmt));
switch lower(fmt)
case ‘eps’
saveas(f,out_path,’epsc’)
case ‘pdf’
exportgraphics(gca, [out_path, ‘.pdf’], ‘ContentType’,’vector’)
case ‘png’
print(f, out_path, ‘-dpng’,’-r300′);
otherwise
warning(‘Unknown fmt: %s. Skipping save.’, fmt);
end
endwhen exporting a fig as a vector, e.g. eps or pdf, if the legend is latex interpreted, the exported graphics do not show the legend. Below a snippet of my code:
% Figure
if showFig
f = figure(‘Color’,’w’);
else
f = figure(‘Visible’,’off’,’Color’,’w’);
end
hold on; grid on; box on; set(gca,’YScale’,’log’);
cols = lines(9);
% Plot ML refined (solid) and CRB/PEB (dashed, black markers)
% Case A
p1 = semilogy(x, RMSE_A, ‘-o’, ‘Color’, cols(1,:), ‘LineWidth’, 1.8, ‘MarkerSize’, 6);
p2 = semilogy(x, PEB_A, ‘–o’, ‘Color’, [0 0 0], ‘LineWidth’, 1.3, ‘MarkerSize’, 5);
% Case B
p3 = semilogy(x, RMSE_B, ‘-s’, ‘Color’, cols(2,:), ‘LineWidth’, 1.8, ‘MarkerSize’, 6);
p4 = semilogy(x, PEB_B, ‘–s’, ‘Color’, [0 0 0], ‘LineWidth’, 1.3, ‘MarkerSize’, 5);
% Case C
p5 = semilogy(x, RMSE_C, ‘-^’, ‘Color’, cols(3,:), ‘LineWidth’, 1.8, ‘MarkerSize’, 6);
p6 = semilogy(x, PEB_C, ‘–^’, ‘Color’, [0 0 0], ‘LineWidth’, 1.3, ‘MarkerSize’, 5);
semilogy(R.values, 20*ones(size(R.values)),’:r’,’LineWidth’,1.8);
xlim([min(x) max(x)])
legend([p1 p2 p3 p4 p5 p6], …
{‘ML RMSE_A’,’PEB_A’,’ML RMSE_B’,’PEB_B’,’ML RMSE_C’,’PEB_C’}, …
‘Location’,’best’,’Interpreter’,’latex’);
xlabel(xlab, ‘Interpreter’,’latex’);
ylabel(‘RMSE / PEB [mm]’, ‘Interpreter’,’latex’);
title(run_title, ‘Interpreter’,’none’);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,18,’LineWidth’,1.2);
% EXPORT FIG
drawnow; % ensure legend is drawn
set(f, ‘Renderer’, ‘painters’); % force vector renderer
set(f, ‘PaperPositionMode’,’auto’); % match figure size
[~, base, ~] = fileparts(mat_path);
out_path = fullfile(files(i).folder, sprintf(‘%s_PEB_ML.%s’, base, fmt));
switch lower(fmt)
case ‘eps’
saveas(f,out_path,’epsc’)
case ‘pdf’
exportgraphics(gca, [out_path, ‘.pdf’], ‘ContentType’,’vector’)
case ‘png’
print(f, out_path, ‘-dpng’,’-r300′);
otherwise
warning(‘Unknown fmt: %s. Skipping save.’, fmt);
end
end when exporting a fig as a vector, e.g. eps or pdf, if the legend is latex interpreted, the exported graphics do not show the legend. Below a snippet of my code:
% Figure
if showFig
f = figure(‘Color’,’w’);
else
f = figure(‘Visible’,’off’,’Color’,’w’);
end
hold on; grid on; box on; set(gca,’YScale’,’log’);
cols = lines(9);
% Plot ML refined (solid) and CRB/PEB (dashed, black markers)
% Case A
p1 = semilogy(x, RMSE_A, ‘-o’, ‘Color’, cols(1,:), ‘LineWidth’, 1.8, ‘MarkerSize’, 6);
p2 = semilogy(x, PEB_A, ‘–o’, ‘Color’, [0 0 0], ‘LineWidth’, 1.3, ‘MarkerSize’, 5);
% Case B
p3 = semilogy(x, RMSE_B, ‘-s’, ‘Color’, cols(2,:), ‘LineWidth’, 1.8, ‘MarkerSize’, 6);
p4 = semilogy(x, PEB_B, ‘–s’, ‘Color’, [0 0 0], ‘LineWidth’, 1.3, ‘MarkerSize’, 5);
% Case C
p5 = semilogy(x, RMSE_C, ‘-^’, ‘Color’, cols(3,:), ‘LineWidth’, 1.8, ‘MarkerSize’, 6);
p6 = semilogy(x, PEB_C, ‘–^’, ‘Color’, [0 0 0], ‘LineWidth’, 1.3, ‘MarkerSize’, 5);
semilogy(R.values, 20*ones(size(R.values)),’:r’,’LineWidth’,1.8);
xlim([min(x) max(x)])
legend([p1 p2 p3 p4 p5 p6], …
{‘ML RMSE_A’,’PEB_A’,’ML RMSE_B’,’PEB_B’,’ML RMSE_C’,’PEB_C’}, …
‘Location’,’best’,’Interpreter’,’latex’);
xlabel(xlab, ‘Interpreter’,’latex’);
ylabel(‘RMSE / PEB [mm]’, ‘Interpreter’,’latex’);
title(run_title, ‘Interpreter’,’none’);
set(gca,’TickLabelInterpreter’,’latex’,’FontSize’,18,’LineWidth’,1.2);
% EXPORT FIG
drawnow; % ensure legend is drawn
set(f, ‘Renderer’, ‘painters’); % force vector renderer
set(f, ‘PaperPositionMode’,’auto’); % match figure size
[~, base, ~] = fileparts(mat_path);
out_path = fullfile(files(i).folder, sprintf(‘%s_PEB_ML.%s’, base, fmt));
switch lower(fmt)
case ‘eps’
saveas(f,out_path,’epsc’)
case ‘pdf’
exportgraphics(gca, [out_path, ‘.pdf’], ‘ContentType’,’vector’)
case ‘png’
print(f, out_path, ‘-dpng’,’-r300′);
otherwise
warning(‘Unknown fmt: %s. Skipping save.’, fmt);
end
end plot, exportgraphics MATLAB Answers — New Questions
I have a code but am unable to use if conditions with matrix value
My code required a condition for avoiding if 0 value read from text and continue to verify the next valueMy code required a condition for avoiding if 0 value read from text and continue to verify the next value My code required a condition for avoiding if 0 value read from text and continue to verify the next value if statement, continue MATLAB Answers — New Questions
tf2sos input argument
I have a question about the input argument to the method tf2sos.
The documentation says it takes the coefficients as vectors of the transfer function
.
I suspect that what is actually meant is that it takes as vectors of the transfer function
.
I have tried the following code, but I can not make sense of it.
clear all;
close all;
ts = 1/10000;
z = tf(‘z’, ts);
b0 = 1;
b1 = 2;
b2 = 3;
a0 = 1;
a1 = -2;
a2 = 5;
H = tf([b2, b1, b0], [a2, a1, a0], ts);
Hi = (b0 + b1*z^-1 + b2*z^-2)/(a0 + a1*z^-1 + a2*z^-2);
[sos_H,g_H] = tf2sos(H.Numerator{1}, H.Denominator{1});
[sos_Hi,g_Hi] = tf2sos(Hi.Numerator{1}, Hi.Denominator{1});
K_H = g_H*(sos_H(1,1) + sos_H(1,2)*z^-1 + sos_H(1,3)*z^-2)/(sos_H(1,4) + sos_H(1,5)*z^-1 + sos_H(1,6)*z^-2);
K_Hi = g_Hi*(sos_Hi(1,1) + sos_Hi(1,2)*z^-1 + sos_Hi(1,3)*z^-2)/(sos_Hi(1,4) + sos_Hi(1,5)*z^-1 + sos_Hi(1,6)*z^-2);
figure()
hold on
step(H);
step(K_H, ‘–‘);
legend();
grid();
figure()
hold on;
step(Hi);
step(K_Hi, ‘–‘);
legend();
grid();
What am I doing wrong?I have a question about the input argument to the method tf2sos.
The documentation says it takes the coefficients as vectors of the transfer function
.
I suspect that what is actually meant is that it takes as vectors of the transfer function
.
I have tried the following code, but I can not make sense of it.
clear all;
close all;
ts = 1/10000;
z = tf(‘z’, ts);
b0 = 1;
b1 = 2;
b2 = 3;
a0 = 1;
a1 = -2;
a2 = 5;
H = tf([b2, b1, b0], [a2, a1, a0], ts);
Hi = (b0 + b1*z^-1 + b2*z^-2)/(a0 + a1*z^-1 + a2*z^-2);
[sos_H,g_H] = tf2sos(H.Numerator{1}, H.Denominator{1});
[sos_Hi,g_Hi] = tf2sos(Hi.Numerator{1}, Hi.Denominator{1});
K_H = g_H*(sos_H(1,1) + sos_H(1,2)*z^-1 + sos_H(1,3)*z^-2)/(sos_H(1,4) + sos_H(1,5)*z^-1 + sos_H(1,6)*z^-2);
K_Hi = g_Hi*(sos_Hi(1,1) + sos_Hi(1,2)*z^-1 + sos_Hi(1,3)*z^-2)/(sos_Hi(1,4) + sos_Hi(1,5)*z^-1 + sos_Hi(1,6)*z^-2);
figure()
hold on
step(H);
step(K_H, ‘–‘);
legend();
grid();
figure()
hold on;
step(Hi);
step(K_Hi, ‘–‘);
legend();
grid();
What am I doing wrong? I have a question about the input argument to the method tf2sos.
The documentation says it takes the coefficients as vectors of the transfer function
.
I suspect that what is actually meant is that it takes as vectors of the transfer function
.
I have tried the following code, but I can not make sense of it.
clear all;
close all;
ts = 1/10000;
z = tf(‘z’, ts);
b0 = 1;
b1 = 2;
b2 = 3;
a0 = 1;
a1 = -2;
a2 = 5;
H = tf([b2, b1, b0], [a2, a1, a0], ts);
Hi = (b0 + b1*z^-1 + b2*z^-2)/(a0 + a1*z^-1 + a2*z^-2);
[sos_H,g_H] = tf2sos(H.Numerator{1}, H.Denominator{1});
[sos_Hi,g_Hi] = tf2sos(Hi.Numerator{1}, Hi.Denominator{1});
K_H = g_H*(sos_H(1,1) + sos_H(1,2)*z^-1 + sos_H(1,3)*z^-2)/(sos_H(1,4) + sos_H(1,5)*z^-1 + sos_H(1,6)*z^-2);
K_Hi = g_Hi*(sos_Hi(1,1) + sos_Hi(1,2)*z^-1 + sos_Hi(1,3)*z^-2)/(sos_Hi(1,4) + sos_Hi(1,5)*z^-1 + sos_Hi(1,6)*z^-2);
figure()
hold on
step(H);
step(K_H, ‘–‘);
legend();
grid();
figure()
hold on;
step(Hi);
step(K_Hi, ‘–‘);
legend();
grid();
What am I doing wrong? tf2sos, tf, second order sections MATLAB Answers — New Questions
Help needed with simulink onramp Discrete systems
This is task 4 in Discrete systems and I have already enabled the scope on the legend, and still it’s showing legend not enabled. It’s the same every time I try and I have attempted this twice already. What is wrong?
It is the same in a few other tasks that require legend to be enabled as well. I am unable to submit them even if the legend is clearly enabled.This is task 4 in Discrete systems and I have already enabled the scope on the legend, and still it’s showing legend not enabled. It’s the same every time I try and I have attempted this twice already. What is wrong?
It is the same in a few other tasks that require legend to be enabled as well. I am unable to submit them even if the legend is clearly enabled. This is task 4 in Discrete systems and I have already enabled the scope on the legend, and still it’s showing legend not enabled. It’s the same every time I try and I have attempted this twice already. What is wrong?
It is the same in a few other tasks that require legend to be enabled as well. I am unable to submit them even if the legend is clearly enabled. graph, scope, simulink MATLAB Answers — New Questions
A more efficient way to do this calculation
Hi all,
I am creating a function that allows me to obtain certain data of Steel Members.
I have created limits that give an interval over which to select a particular member.
Here is my code:
function [HD_cols] = members(Ic);
HD400_1299 = [755000/100^4; 1655/100^2; 1299];
HD400_1202 = [664000/100^4; 1530/100^2; 1202];
HD400_1086 = [596000/100^4; 1386/100^2; 1086];
HD400_990 = [519000/100^4; 1262/100^2; 990];
HD400_900 = [450000/100^4; 1149/100^2; 900];
HD400_818 = [392000/100^4; 1043/100^2; 818];
HD400_744 = [342000/100^4; 948/100^2; 744];
HD400_677 = [300000/100^4; 863/100^2; 677];
HD400_634 = [274000/100^4; 808/100^2; 634];
HD400_592 = [250000/100^4; 755/100^2; 592];
HD400_551 = [226000/100^4; 701/100^2; 551];
HD400_509 = [204000/100^4; 649/100^2; 509];
HD400_463 = [180000/100^4; 590/100^2; 463];
HD400_421 = [160000/100^4; 537/100^2; 421];
T = table(HD400_1299,HD400_1202,HD400_1086,HD400_990,HD400_900,HD400_818,HD400_744,HD400_677,HD400_634,HD400_592,HD400_551,HD400_509,HD400_463,HD400_421);
for i = 1:length(Tx)-1
Limits(i) = (Tx(1,i)+Tx(1,i+1))/2;
end
if Ic > Limits(1)
Ic = HD400_1299
elseif Ic > Limits(2)
Ic = HD400_1202
elseif Ic > Limits(3)
Ic = HD400_1086
elseif Ic > Limits(4)
Ic = HD400_990
elseif Ic > Limits(5)
Ic = HD400_900
elseif Ic > Limits(6)
Ic = HD400_818
elseif Ic > Limits(7)
Ic = HD400_744
elseif Ic > Limits(8)
Ic = HD400_677
elseif Ic > Limits(9)
Ic = HD400_634
elseif Ic > Limits(10)
Ic = HD400_592
elseif Ic > Limits(11)
Ic = HD400_551
elseif Ic > Limits(12)
Ic = HD400_509
elseif Ic > Limits(13)
Ic = HD400_463
elseif Ic > Limits(14)
Ic = HD400_421
end
end
My request is, can somone show me how I can simplify and make more efficient my if statements? Perhaps I need to use a loop? I want to add more members to more script and typing like I have above is tedious and not very efficient. So, I’m hoping someone can help?
Many thanks,
ScottHi all,
I am creating a function that allows me to obtain certain data of Steel Members.
I have created limits that give an interval over which to select a particular member.
Here is my code:
function [HD_cols] = members(Ic);
HD400_1299 = [755000/100^4; 1655/100^2; 1299];
HD400_1202 = [664000/100^4; 1530/100^2; 1202];
HD400_1086 = [596000/100^4; 1386/100^2; 1086];
HD400_990 = [519000/100^4; 1262/100^2; 990];
HD400_900 = [450000/100^4; 1149/100^2; 900];
HD400_818 = [392000/100^4; 1043/100^2; 818];
HD400_744 = [342000/100^4; 948/100^2; 744];
HD400_677 = [300000/100^4; 863/100^2; 677];
HD400_634 = [274000/100^4; 808/100^2; 634];
HD400_592 = [250000/100^4; 755/100^2; 592];
HD400_551 = [226000/100^4; 701/100^2; 551];
HD400_509 = [204000/100^4; 649/100^2; 509];
HD400_463 = [180000/100^4; 590/100^2; 463];
HD400_421 = [160000/100^4; 537/100^2; 421];
T = table(HD400_1299,HD400_1202,HD400_1086,HD400_990,HD400_900,HD400_818,HD400_744,HD400_677,HD400_634,HD400_592,HD400_551,HD400_509,HD400_463,HD400_421);
for i = 1:length(Tx)-1
Limits(i) = (Tx(1,i)+Tx(1,i+1))/2;
end
if Ic > Limits(1)
Ic = HD400_1299
elseif Ic > Limits(2)
Ic = HD400_1202
elseif Ic > Limits(3)
Ic = HD400_1086
elseif Ic > Limits(4)
Ic = HD400_990
elseif Ic > Limits(5)
Ic = HD400_900
elseif Ic > Limits(6)
Ic = HD400_818
elseif Ic > Limits(7)
Ic = HD400_744
elseif Ic > Limits(8)
Ic = HD400_677
elseif Ic > Limits(9)
Ic = HD400_634
elseif Ic > Limits(10)
Ic = HD400_592
elseif Ic > Limits(11)
Ic = HD400_551
elseif Ic > Limits(12)
Ic = HD400_509
elseif Ic > Limits(13)
Ic = HD400_463
elseif Ic > Limits(14)
Ic = HD400_421
end
end
My request is, can somone show me how I can simplify and make more efficient my if statements? Perhaps I need to use a loop? I want to add more members to more script and typing like I have above is tedious and not very efficient. So, I’m hoping someone can help?
Many thanks,
Scott Hi all,
I am creating a function that allows me to obtain certain data of Steel Members.
I have created limits that give an interval over which to select a particular member.
Here is my code:
function [HD_cols] = members(Ic);
HD400_1299 = [755000/100^4; 1655/100^2; 1299];
HD400_1202 = [664000/100^4; 1530/100^2; 1202];
HD400_1086 = [596000/100^4; 1386/100^2; 1086];
HD400_990 = [519000/100^4; 1262/100^2; 990];
HD400_900 = [450000/100^4; 1149/100^2; 900];
HD400_818 = [392000/100^4; 1043/100^2; 818];
HD400_744 = [342000/100^4; 948/100^2; 744];
HD400_677 = [300000/100^4; 863/100^2; 677];
HD400_634 = [274000/100^4; 808/100^2; 634];
HD400_592 = [250000/100^4; 755/100^2; 592];
HD400_551 = [226000/100^4; 701/100^2; 551];
HD400_509 = [204000/100^4; 649/100^2; 509];
HD400_463 = [180000/100^4; 590/100^2; 463];
HD400_421 = [160000/100^4; 537/100^2; 421];
T = table(HD400_1299,HD400_1202,HD400_1086,HD400_990,HD400_900,HD400_818,HD400_744,HD400_677,HD400_634,HD400_592,HD400_551,HD400_509,HD400_463,HD400_421);
for i = 1:length(Tx)-1
Limits(i) = (Tx(1,i)+Tx(1,i+1))/2;
end
if Ic > Limits(1)
Ic = HD400_1299
elseif Ic > Limits(2)
Ic = HD400_1202
elseif Ic > Limits(3)
Ic = HD400_1086
elseif Ic > Limits(4)
Ic = HD400_990
elseif Ic > Limits(5)
Ic = HD400_900
elseif Ic > Limits(6)
Ic = HD400_818
elseif Ic > Limits(7)
Ic = HD400_744
elseif Ic > Limits(8)
Ic = HD400_677
elseif Ic > Limits(9)
Ic = HD400_634
elseif Ic > Limits(10)
Ic = HD400_592
elseif Ic > Limits(11)
Ic = HD400_551
elseif Ic > Limits(12)
Ic = HD400_509
elseif Ic > Limits(13)
Ic = HD400_463
elseif Ic > Limits(14)
Ic = HD400_421
end
end
My request is, can somone show me how I can simplify and make more efficient my if statements? Perhaps I need to use a loop? I want to add more members to more script and typing like I have above is tedious and not very efficient. So, I’m hoping someone can help?
Many thanks,
Scott for, loop, functions, if statement MATLAB Answers — New Questions
Hi all, I want to be a able to paste data in any column all at once not cell by in MATLAB APP table.
T_Fixed = table(StartDates_Fixed,EndDates_Fixed,PaymentDates_Fixed,Notional,fixedrate);
app.Details_Fixed.Data = T_Fixed;
app.Details_Fixed.ColumnEditable =true(1,5);T_Fixed = table(StartDates_Fixed,EndDates_Fixed,PaymentDates_Fixed,Notional,fixedrate);
app.Details_Fixed.Data = T_Fixed;
app.Details_Fixed.ColumnEditable =true(1,5); T_Fixed = table(StartDates_Fixed,EndDates_Fixed,PaymentDates_Fixed,Notional,fixedrate);
app.Details_Fixed.Data = T_Fixed;
app.Details_Fixed.ColumnEditable =true(1,5); app designer, matlab MATLAB Answers — New Questions
need real data for Electrical viechle
Hello dear
I wiuld like to know if nay resarch center or universities can help me to get real data for Electrical viechle
Best regardsHello dear
I wiuld like to know if nay resarch center or universities can help me to get real data for Electrical viechle
Best regards Hello dear
I wiuld like to know if nay resarch center or universities can help me to get real data for Electrical viechle
Best regards need real data for electrical viechle, electrical viechle MATLAB Answers — New Questions