Author: PuTI
Connect line using add_line command to same port connections
While I tried to collect lines in paralel, an error popup:
>> Battery_Array_tmp
Error using Battery_Array_tmp (line 33)
The first port already has a line connection
%%% connect minus to plus ports:
if v>1
add_line(mdl,PH_Add_MC_cube{v-1,i}.LConn(2),PH_Add_MC_cube{v,i}.LConn(2),’Autorouting’,’on’);
end
Can someone assist to solve it?
I adding part of rellevant script:
%%%% Scriptto creat top design – withot Batteries/
%%%% only to speedup simulation time during debug Block connections
open_system(‘Battery_arc_tmp’)
mdl = ‘Battery_arc_tmp’;
battery_model = find_system(mdl,’FindAll’,’on’,’Name’,’Battery_arc_tmp’);
numRows = 3;
% Get handle to existing (external) POS and NEG ports
Plus_MC = find_system(mdl,’LookUnderMasks’,’All’,’FindAll’,’on’,’Name’,’POS’);
Minus_MC = find_system(mdl,’LookUnderMasks’,’All’,’FindAll’,’on’,’Name’,’NEG’);
%%% add MC_cube – basic String_unit:
for i=1:2 %% set two columns
colPos = 500; %% spaces between columns
for v=1:numRows %% loop for 5 String per column
nl=num2str(v + numRows*(i-1));
if i==1
% Add_MC_cube(v) = add_block(‘MC_Cube/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
% % % % % % MC_TMP empty Submodule – only for quick compilation….
Add_MC_cube(v) = add_block(‘MC_TMP/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
else
% Add_MC_cube(v) = add_block(‘MC_Cube2/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
% % % % % % MC_TMP empty Submodule – only for quick compilation….
Add_MC_cube(v) = add_block(‘MC_TMP2/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
end
posc = get(Add_MC_cube(v),’Position’);
set(Add_MC_cube(v),’Position’,posc + [100+(i-1)*colPos 100*(v-1)+45 100+(i-1)*colPos 100*(v-1)+45])
PH_Add_MC_cube{v,i}=get(Add_MC_cube(v),’PortHandles’);
%%% connect minus to plus ports:
if v>1
add_line(mdl,PH_Add_MC_cube{v-1,i}.LConn(2),PH_Add_MC_cube{v,i}.LConn(2),’Autorouting’,’on’);
end
end
end
while connecting 2 module there is no problem/
But when increase above 2 module i gos an error message (above)..
please, see pic attached…
Thank for assist.
TommyWhile I tried to collect lines in paralel, an error popup:
>> Battery_Array_tmp
Error using Battery_Array_tmp (line 33)
The first port already has a line connection
%%% connect minus to plus ports:
if v>1
add_line(mdl,PH_Add_MC_cube{v-1,i}.LConn(2),PH_Add_MC_cube{v,i}.LConn(2),’Autorouting’,’on’);
end
Can someone assist to solve it?
I adding part of rellevant script:
%%%% Scriptto creat top design – withot Batteries/
%%%% only to speedup simulation time during debug Block connections
open_system(‘Battery_arc_tmp’)
mdl = ‘Battery_arc_tmp’;
battery_model = find_system(mdl,’FindAll’,’on’,’Name’,’Battery_arc_tmp’);
numRows = 3;
% Get handle to existing (external) POS and NEG ports
Plus_MC = find_system(mdl,’LookUnderMasks’,’All’,’FindAll’,’on’,’Name’,’POS’);
Minus_MC = find_system(mdl,’LookUnderMasks’,’All’,’FindAll’,’on’,’Name’,’NEG’);
%%% add MC_cube – basic String_unit:
for i=1:2 %% set two columns
colPos = 500; %% spaces between columns
for v=1:numRows %% loop for 5 String per column
nl=num2str(v + numRows*(i-1));
if i==1
% Add_MC_cube(v) = add_block(‘MC_Cube/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
% % % % % % MC_TMP empty Submodule – only for quick compilation….
Add_MC_cube(v) = add_block(‘MC_TMP/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
else
% Add_MC_cube(v) = add_block(‘MC_Cube2/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
% % % % % % MC_TMP empty Submodule – only for quick compilation….
Add_MC_cube(v) = add_block(‘MC_TMP2/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
end
posc = get(Add_MC_cube(v),’Position’);
set(Add_MC_cube(v),’Position’,posc + [100+(i-1)*colPos 100*(v-1)+45 100+(i-1)*colPos 100*(v-1)+45])
PH_Add_MC_cube{v,i}=get(Add_MC_cube(v),’PortHandles’);
%%% connect minus to plus ports:
if v>1
add_line(mdl,PH_Add_MC_cube{v-1,i}.LConn(2),PH_Add_MC_cube{v,i}.LConn(2),’Autorouting’,’on’);
end
end
end
while connecting 2 module there is no problem/
But when increase above 2 module i gos an error message (above)..
please, see pic attached…
Thank for assist.
Tommy While I tried to collect lines in paralel, an error popup:
>> Battery_Array_tmp
Error using Battery_Array_tmp (line 33)
The first port already has a line connection
%%% connect minus to plus ports:
if v>1
add_line(mdl,PH_Add_MC_cube{v-1,i}.LConn(2),PH_Add_MC_cube{v,i}.LConn(2),’Autorouting’,’on’);
end
Can someone assist to solve it?
I adding part of rellevant script:
%%%% Scriptto creat top design – withot Batteries/
%%%% only to speedup simulation time during debug Block connections
open_system(‘Battery_arc_tmp’)
mdl = ‘Battery_arc_tmp’;
battery_model = find_system(mdl,’FindAll’,’on’,’Name’,’Battery_arc_tmp’);
numRows = 3;
% Get handle to existing (external) POS and NEG ports
Plus_MC = find_system(mdl,’LookUnderMasks’,’All’,’FindAll’,’on’,’Name’,’POS’);
Minus_MC = find_system(mdl,’LookUnderMasks’,’All’,’FindAll’,’on’,’Name’,’NEG’);
%%% add MC_cube – basic String_unit:
for i=1:2 %% set two columns
colPos = 500; %% spaces between columns
for v=1:numRows %% loop for 5 String per column
nl=num2str(v + numRows*(i-1));
if i==1
% Add_MC_cube(v) = add_block(‘MC_Cube/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
% % % % % % MC_TMP empty Submodule – only for quick compilation….
Add_MC_cube(v) = add_block(‘MC_TMP/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
else
% Add_MC_cube(v) = add_block(‘MC_Cube2/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
% % % % % % MC_TMP empty Submodule – only for quick compilation….
Add_MC_cube(v) = add_block(‘MC_TMP2/STRING_MC_Cube 1’, [mdl,’/STRING_MC_Cube ‘,nl]);
end
posc = get(Add_MC_cube(v),’Position’);
set(Add_MC_cube(v),’Position’,posc + [100+(i-1)*colPos 100*(v-1)+45 100+(i-1)*colPos 100*(v-1)+45])
PH_Add_MC_cube{v,i}=get(Add_MC_cube(v),’PortHandles’);
%%% connect minus to plus ports:
if v>1
add_line(mdl,PH_Add_MC_cube{v-1,i}.LConn(2),PH_Add_MC_cube{v,i}.LConn(2),’Autorouting’,’on’);
end
end
end
while connecting 2 module there is no problem/
But when increase above 2 module i gos an error message (above)..
please, see pic attached…
Thank for assist.
Tommy matlab, simulink MATLAB Answers — New Questions
quadgk AbsTol/RelTol parameters combinations
Dear network.
I am having trouble getting the desired result of an integral involving Bessel functions Jo and Yo.
Need your help with a powerful set of combinations of the AbsTol/RelTol parameters that will help me get a low-error result
This is the equation I am trying to solve, with t as a parameter:Dear network.
I am having trouble getting the desired result of an integral involving Bessel functions Jo and Yo.
Need your help with a powerful set of combinations of the AbsTol/RelTol parameters that will help me get a low-error result
This is the equation I am trying to solve, with t as a parameter: Dear network.
I am having trouble getting the desired result of an integral involving Bessel functions Jo and Yo.
Need your help with a powerful set of combinations of the AbsTol/RelTol parameters that will help me get a low-error result
This is the equation I am trying to solve, with t as a parameter: quadgk abstol reltol MATLAB Answers — New Questions
Problems encountered when using sph2cart
Here is the code:
clear all
clc
close all
load angles.mat
load vertices.mat
[vectors(:,1), vectors(:,2), vectors(:,3)] = sph2cart(angle_phi_theta(:,1), angle_phi_theta(:,2), 1);
quiver3(vertex_segment(:,1),vertex_segment(:,2),vertex_segment(:,3),…
vectors(:,1),vectors(:,2),vectors(:,3),0.8,’Color’,’green’,’LineWidth’,1);hold on;
The results:
Problem: I think the resulting vectors should converge uniformly or diverge uniformly, but why do they alternate like this? What went wrong?Here is the code:
clear all
clc
close all
load angles.mat
load vertices.mat
[vectors(:,1), vectors(:,2), vectors(:,3)] = sph2cart(angle_phi_theta(:,1), angle_phi_theta(:,2), 1);
quiver3(vertex_segment(:,1),vertex_segment(:,2),vertex_segment(:,3),…
vectors(:,1),vectors(:,2),vectors(:,3),0.8,’Color’,’green’,’LineWidth’,1);hold on;
The results:
Problem: I think the resulting vectors should converge uniformly or diverge uniformly, but why do they alternate like this? What went wrong? Here is the code:
clear all
clc
close all
load angles.mat
load vertices.mat
[vectors(:,1), vectors(:,2), vectors(:,3)] = sph2cart(angle_phi_theta(:,1), angle_phi_theta(:,2), 1);
quiver3(vertex_segment(:,1),vertex_segment(:,2),vertex_segment(:,3),…
vectors(:,1),vectors(:,2),vectors(:,3),0.8,’Color’,’green’,’LineWidth’,1);hold on;
The results:
Problem: I think the resulting vectors should converge uniformly or diverge uniformly, but why do they alternate like this? What went wrong? coordinate transformation, sph2cart, vectors MATLAB Answers — New Questions
i need help in solving this documentation in mathlab “Fault Detection and Localization in Three-Phase Power Transmission Using Deep Signal Anomaly Detector in Simulink” thanks
i am trying to build the exact modle listed on the site but finding challenges navigating through the steps provided .the topic is" Fault Detection and Localization in Three-Phase Power Transmission Using Deep Signal Anomaly Detector in Simulink". i would be very glad if someone can assist me do it. or if anyone has already done it. the person can kindly share his file to assist me. thank youi am trying to build the exact modle listed on the site but finding challenges navigating through the steps provided .the topic is" Fault Detection and Localization in Three-Phase Power Transmission Using Deep Signal Anomaly Detector in Simulink". i would be very glad if someone can assist me do it. or if anyone has already done it. the person can kindly share his file to assist me. thank you i am trying to build the exact modle listed on the site but finding challenges navigating through the steps provided .the topic is" Fault Detection and Localization in Three-Phase Power Transmission Using Deep Signal Anomaly Detector in Simulink". i would be very glad if someone can assist me do it. or if anyone has already done it. the person can kindly share his file to assist me. thank you #simulink, #deep signal anomaly detector #matlab MATLAB Answers — New Questions
Cannot get simulation to run after 2024 upgrade from 2023.
I upgraded from MATLAB/SIMULINK 2023 to 2024. When trying to rerun the simulation that had run in 2023 I get:
"
Error:Unable to update models referenced by ‘plant’.
Caused by:
The corresponding ‘decay_heat_SF.tlc’ file for the MATLAB S-function ‘decay_heat_SF’ in block ‘decay_heat/Level-2 MATLAB S-Function’ must be located in the current working directory, the MATLAB S-function directory ‘D:OneDriveUSNCControl DesignDecay Heat’, or the directory ‘D:OneDriveUSNCControl DesignDecay Heattlc_c’
"
Under 2023b no "decay_heat_SF.tlc" was generated or needed.
When running "decay_heat_SF" as a standalone model it runs. When added as a sub-model in "plant" it gives this error.
Can someone help?I upgraded from MATLAB/SIMULINK 2023 to 2024. When trying to rerun the simulation that had run in 2023 I get:
"
Error:Unable to update models referenced by ‘plant’.
Caused by:
The corresponding ‘decay_heat_SF.tlc’ file for the MATLAB S-function ‘decay_heat_SF’ in block ‘decay_heat/Level-2 MATLAB S-Function’ must be located in the current working directory, the MATLAB S-function directory ‘D:OneDriveUSNCControl DesignDecay Heat’, or the directory ‘D:OneDriveUSNCControl DesignDecay Heattlc_c’
"
Under 2023b no "decay_heat_SF.tlc" was generated or needed.
When running "decay_heat_SF" as a standalone model it runs. When added as a sub-model in "plant" it gives this error.
Can someone help? I upgraded from MATLAB/SIMULINK 2023 to 2024. When trying to rerun the simulation that had run in 2023 I get:
"
Error:Unable to update models referenced by ‘plant’.
Caused by:
The corresponding ‘decay_heat_SF.tlc’ file for the MATLAB S-function ‘decay_heat_SF’ in block ‘decay_heat/Level-2 MATLAB S-Function’ must be located in the current working directory, the MATLAB S-function directory ‘D:OneDriveUSNCControl DesignDecay Heat’, or the directory ‘D:OneDriveUSNCControl DesignDecay Heattlc_c’
"
Under 2023b no "decay_heat_SF.tlc" was generated or needed.
When running "decay_heat_SF" as a standalone model it runs. When added as a sub-model in "plant" it gives this error.
Can someone help? upgrade, tlc MATLAB Answers — New Questions
Bayesian neural network for nonlinear model identification
Hello everyone,
I’m interested in using Bayesian neural networks to model a dynamical system, similar to the examples presented here: https://www.mathworks.com/help/ident/nonlinear-model-identification.html.
So far, the only relevant resource I’ve found is this page: https://www.mathworks.com/help/deeplearning/ug/train-bayesian-neural-network.html, which demonstrates how to train a Bayesian neural network to predict the rotation of handwritten digits.
Would the methodology and functions shown in that example be suitable for my case? Specifically, can they be adapted to train a model using time series data—i.e., sequences of input and output over time?
Thank you in advance for your support!
MarcoHello everyone,
I’m interested in using Bayesian neural networks to model a dynamical system, similar to the examples presented here: https://www.mathworks.com/help/ident/nonlinear-model-identification.html.
So far, the only relevant resource I’ve found is this page: https://www.mathworks.com/help/deeplearning/ug/train-bayesian-neural-network.html, which demonstrates how to train a Bayesian neural network to predict the rotation of handwritten digits.
Would the methodology and functions shown in that example be suitable for my case? Specifically, can they be adapted to train a model using time series data—i.e., sequences of input and output over time?
Thank you in advance for your support!
Marco Hello everyone,
I’m interested in using Bayesian neural networks to model a dynamical system, similar to the examples presented here: https://www.mathworks.com/help/ident/nonlinear-model-identification.html.
So far, the only relevant resource I’ve found is this page: https://www.mathworks.com/help/deeplearning/ug/train-bayesian-neural-network.html, which demonstrates how to train a Bayesian neural network to predict the rotation of handwritten digits.
Would the methodology and functions shown in that example be suitable for my case? Specifically, can they be adapted to train a model using time series data—i.e., sequences of input and output over time?
Thank you in advance for your support!
Marco bayes, neural networks, system identification, deep learning, uncertainty quantification MATLAB Answers — New Questions
How to disable Tab completion in MATLAB Editor and Command Window
Is it possible to disable Tab completion in the MATLAB Editor and Command Window?Is it possible to disable Tab completion in the MATLAB Editor and Command Window? Is it possible to disable Tab completion in the MATLAB Editor and Command Window? disable, tab, completion MATLAB Answers — New Questions
assigning values with []
[a,b]=[1,2]
Why doesn’t this work? How to rewrite into what is easier and more succinct than a=1; b=2?[a,b]=[1,2]
Why doesn’t this work? How to rewrite into what is easier and more succinct than a=1; b=2? [a,b]=[1,2]
Why doesn’t this work? How to rewrite into what is easier and more succinct than a=1; b=2? matlab MATLAB Answers — New Questions
Unknown error during installation MATLAB2015a
During the installation of Matlab 2015a, at a level of 99% a pop-up window appeared with the following notification: " Unknown Error. The application encountered an unexpected error and needs to close. You may want to try re-installing your product(s). More information can be found at C:users…Tempmathworks_cform.log".
Why does this error appear during installation?
How can I solve that?During the installation of Matlab 2015a, at a level of 99% a pop-up window appeared with the following notification: " Unknown Error. The application encountered an unexpected error and needs to close. You may want to try re-installing your product(s). More information can be found at C:users…Tempmathworks_cform.log".
Why does this error appear during installation?
How can I solve that? During the installation of Matlab 2015a, at a level of 99% a pop-up window appeared with the following notification: " Unknown Error. The application encountered an unexpected error and needs to close. You may want to try re-installing your product(s). More information can be found at C:users…Tempmathworks_cform.log".
Why does this error appear during installation?
How can I solve that? error, installation MATLAB Answers — New Questions
Minor mistake Writing a function but error
Hello just a quick question, I am writing a code but an error keeps poping up for the function I entered
By any chance would you know why it keeps coming up as a red warning
f=@ (1./x)+(sqrt(x).*exp(x));Hello just a quick question, I am writing a code but an error keeps poping up for the function I entered
By any chance would you know why it keeps coming up as a red warning
f=@ (1./x)+(sqrt(x).*exp(x)); Hello just a quick question, I am writing a code but an error keeps poping up for the function I entered
By any chance would you know why it keeps coming up as a red warning
f=@ (1./x)+(sqrt(x).*exp(x)); function, error, display MATLAB Answers — New Questions
Trying to add callback function in class
I am attempting to create a class the will have two line ROI objects. This class should have a callback function for when the lines are moved by the user. I am able to add a listener to the lines but only if the callback function is static.
Is it possible to do this without using a static method? Ultimatly I would like to use the callback method to compare the positions of the two lines as one of them is moved.
classdef imageRange < handle
properties
region double
line1
line2
rect
X double
end
methods
function obj = imageRange(axes, dataAxes)
x = dataAxes{1,4};
y = dataAxes{2,4};
midpoint = mean([x(1),x(3)]);
obj.X = floor(midpoint);
obj.rect = rectangle(axes,’Position’,[obj.X,y(1),…
ceil(midpoint)-floor(midpoint), y(3) – y(1)]);
obj.rect.EdgeColor = [0,0,0,0];
obj.rect.FaceColor = [.5,.5,.5];
obj.rect.FaceAlpha = .1;
obj.line1 = drawline(axes,’Position’,[floor(midpoint), y(1); …
floor(midpoint), y(3)],’Color’,[0.6350 0.0780 0.1840], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
addlistener(obj.line1, ‘MovingROI’, @(src,event)obj.allevents(src,event));
obj.line2 = drawline(axes,’Position’,[ceil(midpoint), y(1); …
ceil(midpoint), y(3)],’Color’,[0 0.4470 0.7410], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
obj.region = dataAxes{1,5};
end
end
methods (Static)
function allevents(src,event)
event.PreviousPosition(1,1)
end
end
endI am attempting to create a class the will have two line ROI objects. This class should have a callback function for when the lines are moved by the user. I am able to add a listener to the lines but only if the callback function is static.
Is it possible to do this without using a static method? Ultimatly I would like to use the callback method to compare the positions of the two lines as one of them is moved.
classdef imageRange < handle
properties
region double
line1
line2
rect
X double
end
methods
function obj = imageRange(axes, dataAxes)
x = dataAxes{1,4};
y = dataAxes{2,4};
midpoint = mean([x(1),x(3)]);
obj.X = floor(midpoint);
obj.rect = rectangle(axes,’Position’,[obj.X,y(1),…
ceil(midpoint)-floor(midpoint), y(3) – y(1)]);
obj.rect.EdgeColor = [0,0,0,0];
obj.rect.FaceColor = [.5,.5,.5];
obj.rect.FaceAlpha = .1;
obj.line1 = drawline(axes,’Position’,[floor(midpoint), y(1); …
floor(midpoint), y(3)],’Color’,[0.6350 0.0780 0.1840], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
addlistener(obj.line1, ‘MovingROI’, @(src,event)obj.allevents(src,event));
obj.line2 = drawline(axes,’Position’,[ceil(midpoint), y(1); …
ceil(midpoint), y(3)],’Color’,[0 0.4470 0.7410], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
obj.region = dataAxes{1,5};
end
end
methods (Static)
function allevents(src,event)
event.PreviousPosition(1,1)
end
end
end I am attempting to create a class the will have two line ROI objects. This class should have a callback function for when the lines are moved by the user. I am able to add a listener to the lines but only if the callback function is static.
Is it possible to do this without using a static method? Ultimatly I would like to use the callback method to compare the positions of the two lines as one of them is moved.
classdef imageRange < handle
properties
region double
line1
line2
rect
X double
end
methods
function obj = imageRange(axes, dataAxes)
x = dataAxes{1,4};
y = dataAxes{2,4};
midpoint = mean([x(1),x(3)]);
obj.X = floor(midpoint);
obj.rect = rectangle(axes,’Position’,[obj.X,y(1),…
ceil(midpoint)-floor(midpoint), y(3) – y(1)]);
obj.rect.EdgeColor = [0,0,0,0];
obj.rect.FaceColor = [.5,.5,.5];
obj.rect.FaceAlpha = .1;
obj.line1 = drawline(axes,’Position’,[floor(midpoint), y(1); …
floor(midpoint), y(3)],’Color’,[0.6350 0.0780 0.1840], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
addlistener(obj.line1, ‘MovingROI’, @(src,event)obj.allevents(src,event));
obj.line2 = drawline(axes,’Position’,[ceil(midpoint), y(1); …
ceil(midpoint), y(3)],’Color’,[0 0.4470 0.7410], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
obj.region = dataAxes{1,5};
end
end
methods (Static)
function allevents(src,event)
event.PreviousPosition(1,1)
end
end
end static methods, class MATLAB Answers — New Questions
Reverse 2D-lookup table in Simulink
I tried to implement a reverse 2D lookup table in Simulink according to the following description by Fangjun Jiang:
https://de.mathworks.com/matlabcentral/answers/12809-reverse-2d-lookup-table?s_tid=sug_su
First, I wrote the following Matlab code for testing and it does exactly what I expect:
% Absolute eccentricity range
e = 0:1e-06:1.5e-05;
% Piston phase angle range
rad = 0:2*pi/400:2*pi;
% Load capacity matrix
load(‘Tragkraft_alpha_AK_kpl_V03.mat’);
load_cap = Tragkraft_alpha_AK_kpl_V03;
% Instant piston phase angle
rad_dyn = 3.12588469032184;
% Reverse 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% Instant load capacity
load_dyn = 659.331131439451;
% Instant absolute eccentricity
e_dyn = interp1(lookup,e,load_dyn);
After that, I tried to implement it in Simulink using a MATLAB function block with the following code:
function e_dyn = fcn(rad_dyn, load_dyn, load_cap)
% absolute eccentricity range
e = 0:1e-06:1.5e-05;
% piston phase angle range
rad = 0:2*pi/400:2*pi;
% 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% instant absolute eccentricity
e_dyn=interp1(lookup,e,load_dyn);
However, this leads to the following error message that I don’t really understand. In my understanding the Simulink model should do exactly the same as the Matlab code. Can anybody tell me how to fix that in Simulink?I tried to implement a reverse 2D lookup table in Simulink according to the following description by Fangjun Jiang:
https://de.mathworks.com/matlabcentral/answers/12809-reverse-2d-lookup-table?s_tid=sug_su
First, I wrote the following Matlab code for testing and it does exactly what I expect:
% Absolute eccentricity range
e = 0:1e-06:1.5e-05;
% Piston phase angle range
rad = 0:2*pi/400:2*pi;
% Load capacity matrix
load(‘Tragkraft_alpha_AK_kpl_V03.mat’);
load_cap = Tragkraft_alpha_AK_kpl_V03;
% Instant piston phase angle
rad_dyn = 3.12588469032184;
% Reverse 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% Instant load capacity
load_dyn = 659.331131439451;
% Instant absolute eccentricity
e_dyn = interp1(lookup,e,load_dyn);
After that, I tried to implement it in Simulink using a MATLAB function block with the following code:
function e_dyn = fcn(rad_dyn, load_dyn, load_cap)
% absolute eccentricity range
e = 0:1e-06:1.5e-05;
% piston phase angle range
rad = 0:2*pi/400:2*pi;
% 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% instant absolute eccentricity
e_dyn=interp1(lookup,e,load_dyn);
However, this leads to the following error message that I don’t really understand. In my understanding the Simulink model should do exactly the same as the Matlab code. Can anybody tell me how to fix that in Simulink? I tried to implement a reverse 2D lookup table in Simulink according to the following description by Fangjun Jiang:
https://de.mathworks.com/matlabcentral/answers/12809-reverse-2d-lookup-table?s_tid=sug_su
First, I wrote the following Matlab code for testing and it does exactly what I expect:
% Absolute eccentricity range
e = 0:1e-06:1.5e-05;
% Piston phase angle range
rad = 0:2*pi/400:2*pi;
% Load capacity matrix
load(‘Tragkraft_alpha_AK_kpl_V03.mat’);
load_cap = Tragkraft_alpha_AK_kpl_V03;
% Instant piston phase angle
rad_dyn = 3.12588469032184;
% Reverse 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% Instant load capacity
load_dyn = 659.331131439451;
% Instant absolute eccentricity
e_dyn = interp1(lookup,e,load_dyn);
After that, I tried to implement it in Simulink using a MATLAB function block with the following code:
function e_dyn = fcn(rad_dyn, load_dyn, load_cap)
% absolute eccentricity range
e = 0:1e-06:1.5e-05;
% piston phase angle range
rad = 0:2*pi/400:2*pi;
% 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% instant absolute eccentricity
e_dyn=interp1(lookup,e,load_dyn);
However, this leads to the following error message that I don’t really understand. In my understanding the Simulink model should do exactly the same as the Matlab code. Can anybody tell me how to fix that in Simulink? lookup table, reverse, simulink MATLAB Answers — New Questions
Invalid initial condition error
I have to solve the sistem of differential equation odesys with the condition imposed in bc vector. I obtain the "Invalid Initial Condition" at the line where v is defined, even if the domain for the boundary condition is correct. I must keep it a symbolic solution and a0 is a costant.
%% ANALYTICAL MODEL FOR A DCB SPECIMEN UNDER THE CONDITION OF PRESCRIBED DISPLACEMENTS
%% Linear Elastic Phase
%———
syms x d v0(x) v1(x) v2(x) Lcz
%———
phi0 = -diff(v0,x);
M0 = E*I*diff(v0,x,2);
T0 = E*I*diff(v0,x,3);
phi1 = -diff(v1,x);
M1 = E*I*diff(v1,x,2);
T1 = E*I*diff(v1,x,3);
phi2 = -diff(v2,x);
M2 = E*I*diff(v2,x,2);
T2 = E*I*diff(v2,x,3);
%———
ode_0 = diff(v0,x,4) == 0;
ode_1 = diff(v1,x,4) – 2*w*(lambda^2)*diff(v1,x,2) + (lambda^4)*v1 == 0;
ode_2 = diff(v2,x,4) + 2*ps*(k^2)*diff(v2,x,2) – k^4*(v2 – d_c/2) == 0;
%———
syms xL xR xI
xL = -a0 – Lcz;
xI = -Lcz;
xR = L – a0 – Lcz;
c1 = v0(xL) == d/2;
c2 = M0(xL) == 0;
c3 = v0(xI) == v2(xI);
c4 = phi0(xI) == phi2(xI);
c5 = M0(xI) == M2(xI);
c6 = T0(xI) == T2(xI);
c7 = v1(0) == v2(0);
c8 = phi1(0) == phi2(0);
c9 = M1(0) == M2(0);
c10 = T1(0) == T2(0);
c11 = v1(xR) == 0;
c12 = phi1(xR) == 0;
%———
odesys = [ode_0; ode_1; ode_2];
bc = [c1; c2; c3; c4; c5; c6; c7; c8; c9; c10; c11; c12];
v = dsolve(odesys, bc);
%———
v1_sol(x,d,Lcz) = simplify(v.v1);
v0_sol(x,d,Lcz) = simplify(v.v0);
v2_sol(x,d,Lcz) = simplify(v.v2);
phi0_sol(x,d,Lcz) = diff(v0_sol,x);
phi1_sol(x,d,Lcz) = diff(v1_sol,x);
phi2_sol(x,d,Lcz) = diff(v2_sol,x);
M0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,2);
M1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,2);
M2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,2);
T0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,3);
T1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,3);
T2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,3);
%———
d_lim = solve(v0_sol(0,d,0) == d_0/2,d);
% d_max = solve(v0_sol(0,d,0) == d_0/2,d);
% Lcz_max = solve(v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0, x,[0 50]);
[d_max, Lcz_max] = solve([v1_sol(0,d,Lcz) – d_0/2 == 0, v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0],[d,Lcz]);I have to solve the sistem of differential equation odesys with the condition imposed in bc vector. I obtain the "Invalid Initial Condition" at the line where v is defined, even if the domain for the boundary condition is correct. I must keep it a symbolic solution and a0 is a costant.
%% ANALYTICAL MODEL FOR A DCB SPECIMEN UNDER THE CONDITION OF PRESCRIBED DISPLACEMENTS
%% Linear Elastic Phase
%———
syms x d v0(x) v1(x) v2(x) Lcz
%———
phi0 = -diff(v0,x);
M0 = E*I*diff(v0,x,2);
T0 = E*I*diff(v0,x,3);
phi1 = -diff(v1,x);
M1 = E*I*diff(v1,x,2);
T1 = E*I*diff(v1,x,3);
phi2 = -diff(v2,x);
M2 = E*I*diff(v2,x,2);
T2 = E*I*diff(v2,x,3);
%———
ode_0 = diff(v0,x,4) == 0;
ode_1 = diff(v1,x,4) – 2*w*(lambda^2)*diff(v1,x,2) + (lambda^4)*v1 == 0;
ode_2 = diff(v2,x,4) + 2*ps*(k^2)*diff(v2,x,2) – k^4*(v2 – d_c/2) == 0;
%———
syms xL xR xI
xL = -a0 – Lcz;
xI = -Lcz;
xR = L – a0 – Lcz;
c1 = v0(xL) == d/2;
c2 = M0(xL) == 0;
c3 = v0(xI) == v2(xI);
c4 = phi0(xI) == phi2(xI);
c5 = M0(xI) == M2(xI);
c6 = T0(xI) == T2(xI);
c7 = v1(0) == v2(0);
c8 = phi1(0) == phi2(0);
c9 = M1(0) == M2(0);
c10 = T1(0) == T2(0);
c11 = v1(xR) == 0;
c12 = phi1(xR) == 0;
%———
odesys = [ode_0; ode_1; ode_2];
bc = [c1; c2; c3; c4; c5; c6; c7; c8; c9; c10; c11; c12];
v = dsolve(odesys, bc);
%———
v1_sol(x,d,Lcz) = simplify(v.v1);
v0_sol(x,d,Lcz) = simplify(v.v0);
v2_sol(x,d,Lcz) = simplify(v.v2);
phi0_sol(x,d,Lcz) = diff(v0_sol,x);
phi1_sol(x,d,Lcz) = diff(v1_sol,x);
phi2_sol(x,d,Lcz) = diff(v2_sol,x);
M0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,2);
M1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,2);
M2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,2);
T0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,3);
T1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,3);
T2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,3);
%———
d_lim = solve(v0_sol(0,d,0) == d_0/2,d);
% d_max = solve(v0_sol(0,d,0) == d_0/2,d);
% Lcz_max = solve(v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0, x,[0 50]);
[d_max, Lcz_max] = solve([v1_sol(0,d,Lcz) – d_0/2 == 0, v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0],[d,Lcz]); I have to solve the sistem of differential equation odesys with the condition imposed in bc vector. I obtain the "Invalid Initial Condition" at the line where v is defined, even if the domain for the boundary condition is correct. I must keep it a symbolic solution and a0 is a costant.
%% ANALYTICAL MODEL FOR A DCB SPECIMEN UNDER THE CONDITION OF PRESCRIBED DISPLACEMENTS
%% Linear Elastic Phase
%———
syms x d v0(x) v1(x) v2(x) Lcz
%———
phi0 = -diff(v0,x);
M0 = E*I*diff(v0,x,2);
T0 = E*I*diff(v0,x,3);
phi1 = -diff(v1,x);
M1 = E*I*diff(v1,x,2);
T1 = E*I*diff(v1,x,3);
phi2 = -diff(v2,x);
M2 = E*I*diff(v2,x,2);
T2 = E*I*diff(v2,x,3);
%———
ode_0 = diff(v0,x,4) == 0;
ode_1 = diff(v1,x,4) – 2*w*(lambda^2)*diff(v1,x,2) + (lambda^4)*v1 == 0;
ode_2 = diff(v2,x,4) + 2*ps*(k^2)*diff(v2,x,2) – k^4*(v2 – d_c/2) == 0;
%———
syms xL xR xI
xL = -a0 – Lcz;
xI = -Lcz;
xR = L – a0 – Lcz;
c1 = v0(xL) == d/2;
c2 = M0(xL) == 0;
c3 = v0(xI) == v2(xI);
c4 = phi0(xI) == phi2(xI);
c5 = M0(xI) == M2(xI);
c6 = T0(xI) == T2(xI);
c7 = v1(0) == v2(0);
c8 = phi1(0) == phi2(0);
c9 = M1(0) == M2(0);
c10 = T1(0) == T2(0);
c11 = v1(xR) == 0;
c12 = phi1(xR) == 0;
%———
odesys = [ode_0; ode_1; ode_2];
bc = [c1; c2; c3; c4; c5; c6; c7; c8; c9; c10; c11; c12];
v = dsolve(odesys, bc);
%———
v1_sol(x,d,Lcz) = simplify(v.v1);
v0_sol(x,d,Lcz) = simplify(v.v0);
v2_sol(x,d,Lcz) = simplify(v.v2);
phi0_sol(x,d,Lcz) = diff(v0_sol,x);
phi1_sol(x,d,Lcz) = diff(v1_sol,x);
phi2_sol(x,d,Lcz) = diff(v2_sol,x);
M0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,2);
M1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,2);
M2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,2);
T0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,3);
T1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,3);
T2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,3);
%———
d_lim = solve(v0_sol(0,d,0) == d_0/2,d);
% d_max = solve(v0_sol(0,d,0) == d_0/2,d);
% Lcz_max = solve(v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0, x,[0 50]);
[d_max, Lcz_max] = solve([v1_sol(0,d,Lcz) – d_0/2 == 0, v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0],[d,Lcz]); dsolve, ode, symbolic MATLAB Answers — New Questions
Error while creating Target starting from reference target ‘Aurix Tricore TC3x’
Hello,
I’m trying to use the Aurix Tricore TC3x Simulink Support Package to work with my TC36 board.
Since the available hardware options are only TC37, TC38, and TC39, I would like to create a new target for the TC36.
Rather than creating a new target from scratch and manually selecting all the features, I’m trying to inherit everything from the existing target and only modify the shared libraries (iLLD), the linker and the loader.
I’m using the following command:
tgt = createTarget(‘my TC36’, ‘Infineon AURIX TC3x’,’C:/TC36_TargetV1′, ‘initialize’)
But I get this error:
Error using matlabshared.targetsdk.Target/loadReferenceTargetObjects
Unable to load reference target ‘Infineon AURIX TC3x’.A table row name subscript must be a character vector, string array, or cell array of
character vectors
Error in matlabshared.targetsdk.Target
Error in createTarget (line 129)
targetObj = matlabshared.targetsdk.Target(name,refTarget,targetFolder,option);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Proceeding, I discovered that the error comes from:
matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
That gives the following:
>> matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
Error using {} (line 162)
A table row name subscript must be a character vector, string array, or cell array of character vectors
Error in matlabshared.targetsdk.Target/mapFeature
Error in matlabshared.targetsdk.Target/map
Error in matlabshared.targetsdk.Target/addNewBaremetalScheduler
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
In particular in braceAssign.m on the line 162.
I also tried to use the loadTarget function with the ‘ARM Cortex-A’ target and it worked.
Therefore, The problem can be that I don’t know the exact target name of Infineon AURIX TC3x to use as the reference target, but I also tried to insert a wrong name argument to the loadTarget function and it gives a different result:
matlabshared.targetsdk.loadTarget(‘Infineon’)
Error using matlabshared.targetsdk.loadTarget
The target ‘Infineon’ is not registered. Make sure that the name of the target is correct and that its folders are on the MATLAB path. Also, make
sure to run ‘sl_refresh_customizations’ after you restart MATLAB.
Concluding, how can I use the Infineon AURIX TC3x as reference target?
Thank you!Hello,
I’m trying to use the Aurix Tricore TC3x Simulink Support Package to work with my TC36 board.
Since the available hardware options are only TC37, TC38, and TC39, I would like to create a new target for the TC36.
Rather than creating a new target from scratch and manually selecting all the features, I’m trying to inherit everything from the existing target and only modify the shared libraries (iLLD), the linker and the loader.
I’m using the following command:
tgt = createTarget(‘my TC36’, ‘Infineon AURIX TC3x’,’C:/TC36_TargetV1′, ‘initialize’)
But I get this error:
Error using matlabshared.targetsdk.Target/loadReferenceTargetObjects
Unable to load reference target ‘Infineon AURIX TC3x’.A table row name subscript must be a character vector, string array, or cell array of
character vectors
Error in matlabshared.targetsdk.Target
Error in createTarget (line 129)
targetObj = matlabshared.targetsdk.Target(name,refTarget,targetFolder,option);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Proceeding, I discovered that the error comes from:
matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
That gives the following:
>> matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
Error using {} (line 162)
A table row name subscript must be a character vector, string array, or cell array of character vectors
Error in matlabshared.targetsdk.Target/mapFeature
Error in matlabshared.targetsdk.Target/map
Error in matlabshared.targetsdk.Target/addNewBaremetalScheduler
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
In particular in braceAssign.m on the line 162.
I also tried to use the loadTarget function with the ‘ARM Cortex-A’ target and it worked.
Therefore, The problem can be that I don’t know the exact target name of Infineon AURIX TC3x to use as the reference target, but I also tried to insert a wrong name argument to the loadTarget function and it gives a different result:
matlabshared.targetsdk.loadTarget(‘Infineon’)
Error using matlabshared.targetsdk.loadTarget
The target ‘Infineon’ is not registered. Make sure that the name of the target is correct and that its folders are on the MATLAB path. Also, make
sure to run ‘sl_refresh_customizations’ after you restart MATLAB.
Concluding, how can I use the Infineon AURIX TC3x as reference target?
Thank you! Hello,
I’m trying to use the Aurix Tricore TC3x Simulink Support Package to work with my TC36 board.
Since the available hardware options are only TC37, TC38, and TC39, I would like to create a new target for the TC36.
Rather than creating a new target from scratch and manually selecting all the features, I’m trying to inherit everything from the existing target and only modify the shared libraries (iLLD), the linker and the loader.
I’m using the following command:
tgt = createTarget(‘my TC36’, ‘Infineon AURIX TC3x’,’C:/TC36_TargetV1′, ‘initialize’)
But I get this error:
Error using matlabshared.targetsdk.Target/loadReferenceTargetObjects
Unable to load reference target ‘Infineon AURIX TC3x’.A table row name subscript must be a character vector, string array, or cell array of
character vectors
Error in matlabshared.targetsdk.Target
Error in createTarget (line 129)
targetObj = matlabshared.targetsdk.Target(name,refTarget,targetFolder,option);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Proceeding, I discovered that the error comes from:
matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
That gives the following:
>> matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
Error using {} (line 162)
A table row name subscript must be a character vector, string array, or cell array of character vectors
Error in matlabshared.targetsdk.Target/mapFeature
Error in matlabshared.targetsdk.Target/map
Error in matlabshared.targetsdk.Target/addNewBaremetalScheduler
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
In particular in braceAssign.m on the line 162.
I also tried to use the loadTarget function with the ‘ARM Cortex-A’ target and it worked.
Therefore, The problem can be that I don’t know the exact target name of Infineon AURIX TC3x to use as the reference target, but I also tried to insert a wrong name argument to the loadTarget function and it gives a different result:
matlabshared.targetsdk.loadTarget(‘Infineon’)
Error using matlabshared.targetsdk.loadTarget
The target ‘Infineon’ is not registered. Make sure that the name of the target is correct and that its folders are on the MATLAB path. Also, make
sure to run ‘sl_refresh_customizations’ after you restart MATLAB.
Concluding, how can I use the Infineon AURIX TC3x as reference target?
Thank you! compiler sdk, embedded coder, infineon aurix tc3x support package, target sdk MATLAB Answers — New Questions
How to extract gray matter volumes based on a specific atlas using SPM and CAT12?
Hi everyone,
I’m new to MATLAB, SPM and CAT12, and I’m learning how to perform Voxel-Based Morphometry .
I’ve already preprocessed a T1-weighted MRI image using CAT12 and obtained TIV statis. Now I’d like to extract regional gray matter volume information from the mwp1.nii file, based on anatomical regions defined by an atlas (e.g., AAL atlas).
Could someone please guide me on how to do this?
Thanks in advance!Hi everyone,
I’m new to MATLAB, SPM and CAT12, and I’m learning how to perform Voxel-Based Morphometry .
I’ve already preprocessed a T1-weighted MRI image using CAT12 and obtained TIV statis. Now I’d like to extract regional gray matter volume information from the mwp1.nii file, based on anatomical regions defined by an atlas (e.g., AAL atlas).
Could someone please guide me on how to do this?
Thanks in advance! Hi everyone,
I’m new to MATLAB, SPM and CAT12, and I’m learning how to perform Voxel-Based Morphometry .
I’ve already preprocessed a T1-weighted MRI image using CAT12 and obtained TIV statis. Now I’d like to extract regional gray matter volume information from the mwp1.nii file, based on anatomical regions defined by an atlas (e.g., AAL atlas).
Could someone please guide me on how to do this?
Thanks in advance! image segmentation, cat12, spm, mri, gray matter MATLAB Answers — New Questions
Can someone help me name all this component Thak youu
name for each componentname for each component name for each component simulink, block diagram MATLAB Answers — New Questions
Clarification with IEC certified tools and the need for separate IEC certification kit
Hi,
As far as I read from the MATLAB website, the tools such as Matlab, Simulink, Embedded Coder,… are already ISO/IEC certified tools, but then, I am confused on the need for separate IEC certification kit available, to qualify those tools? Could you please clarify?
Thanks in advanceHi,
As far as I read from the MATLAB website, the tools such as Matlab, Simulink, Embedded Coder,… are already ISO/IEC certified tools, but then, I am confused on the need for separate IEC certification kit available, to qualify those tools? Could you please clarify?
Thanks in advance Hi,
As far as I read from the MATLAB website, the tools such as Matlab, Simulink, Embedded Coder,… are already ISO/IEC certified tools, but then, I am confused on the need for separate IEC certification kit available, to qualify those tools? Could you please clarify?
Thanks in advance iec61508, iso26262, toolbox, certification MATLAB Answers — New Questions
Ignoring Octave-specific code in Matlab 2024b
I have a following bit of code specific to Octave, in a project that is also meant to be run in Matlab:
if (isOctave())
% Set the tick label precision
set(gca, ‘xticklabel’, cellstr(num2str(get(gca, ‘xtick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
set(gca, ‘yticklabel’, cellstr(num2str(get(gca, ‘ytick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
% Set axis font size
set(gca, ‘fontsize’, 12)
end
That particular code is needed for Octave to display figures properly.
And isOctave.m is as follows:
function retval = isOctave
persistent cacheval; % speeds up repeated calls
if isempty (cacheval)
cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
end
retval = cacheval;
end
isOctave() has been tested to properly return 0 (false) in Matlab and 1 (true) in Octave.
Now, in Matlab an error message is produced due to the indexing with a colon:
Error: File: foobar.m Line: 117 Column: 41
Invalid array indexing.
And since the code to be executed is guarded with isOctave(), which returns ‘false’, logically that code section should not even be executed in Matlab. So it’s weird that such error is being generated. And it even persist after adding the suppresstion %#ok<SBTMP,*ALL> in there.I have a following bit of code specific to Octave, in a project that is also meant to be run in Matlab:
if (isOctave())
% Set the tick label precision
set(gca, ‘xticklabel’, cellstr(num2str(get(gca, ‘xtick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
set(gca, ‘yticklabel’, cellstr(num2str(get(gca, ‘ytick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
% Set axis font size
set(gca, ‘fontsize’, 12)
end
That particular code is needed for Octave to display figures properly.
And isOctave.m is as follows:
function retval = isOctave
persistent cacheval; % speeds up repeated calls
if isempty (cacheval)
cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
end
retval = cacheval;
end
isOctave() has been tested to properly return 0 (false) in Matlab and 1 (true) in Octave.
Now, in Matlab an error message is produced due to the indexing with a colon:
Error: File: foobar.m Line: 117 Column: 41
Invalid array indexing.
And since the code to be executed is guarded with isOctave(), which returns ‘false’, logically that code section should not even be executed in Matlab. So it’s weird that such error is being generated. And it even persist after adding the suppresstion %#ok<SBTMP,*ALL> in there. I have a following bit of code specific to Octave, in a project that is also meant to be run in Matlab:
if (isOctave())
% Set the tick label precision
set(gca, ‘xticklabel’, cellstr(num2str(get(gca, ‘xtick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
set(gca, ‘yticklabel’, cellstr(num2str(get(gca, ‘ytick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
% Set axis font size
set(gca, ‘fontsize’, 12)
end
That particular code is needed for Octave to display figures properly.
And isOctave.m is as follows:
function retval = isOctave
persistent cacheval; % speeds up repeated calls
if isempty (cacheval)
cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
end
retval = cacheval;
end
isOctave() has been tested to properly return 0 (false) in Matlab and 1 (true) in Octave.
Now, in Matlab an error message is produced due to the indexing with a colon:
Error: File: foobar.m Line: 117 Column: 41
Invalid array indexing.
And since the code to be executed is guarded with isOctave(), which returns ‘false’, logically that code section should not even be executed in Matlab. So it’s weird that such error is being generated. And it even persist after adding the suppresstion %#ok<SBTMP,*ALL> in there. matlab, octave, code, portable MATLAB Answers — New Questions
Change in OOP programming between 2014a and 2016 – Structures not recognized anymore?
Hello all,
I’m working on a project that was coded in 2014a version and trying to bring it up the MatLab versions. I tried to bring it from the 2014a to 2016a version but I seem to have an issue with how the Object Oriented Programming files are handled by Matlab.
Here’s a ‘picture’ of my directory :
I have an issue where Matlab says that :
Warning: ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformation’ exceeds MATLAB’s maximum name length of 63 characters
and has been truncated to ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio’.
….
Undefined variable "aaa" or class "aaa.bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio".
Error in … (line …)
oPlugin = aaa.(sPlugin(6:end))(this, oParent, oGUI, varargin{:});
Has something changed in the way files and folders are handled my Matlab / OOP in the transition from 2014a to 2016a as it’s working in the 2014a version?
Also, I’m going from 2014a to 2023b versions of Matlab. Is a ‘stop’ at the 2016a version before going to the 2023b version worth it?
Thanks !Hello all,
I’m working on a project that was coded in 2014a version and trying to bring it up the MatLab versions. I tried to bring it from the 2014a to 2016a version but I seem to have an issue with how the Object Oriented Programming files are handled by Matlab.
Here’s a ‘picture’ of my directory :
I have an issue where Matlab says that :
Warning: ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformation’ exceeds MATLAB’s maximum name length of 63 characters
and has been truncated to ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio’.
….
Undefined variable "aaa" or class "aaa.bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio".
Error in … (line …)
oPlugin = aaa.(sPlugin(6:end))(this, oParent, oGUI, varargin{:});
Has something changed in the way files and folders are handled my Matlab / OOP in the transition from 2014a to 2016a as it’s working in the 2014a version?
Also, I’m going from 2014a to 2023b versions of Matlab. Is a ‘stop’ at the 2016a version before going to the 2023b version worth it?
Thanks ! Hello all,
I’m working on a project that was coded in 2014a version and trying to bring it up the MatLab versions. I tried to bring it from the 2014a to 2016a version but I seem to have an issue with how the Object Oriented Programming files are handled by Matlab.
Here’s a ‘picture’ of my directory :
I have an issue where Matlab says that :
Warning: ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformation’ exceeds MATLAB’s maximum name length of 63 characters
and has been truncated to ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio’.
….
Undefined variable "aaa" or class "aaa.bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio".
Error in … (line …)
oPlugin = aaa.(sPlugin(6:end))(this, oParent, oGUI, varargin{:});
Has something changed in the way files and folders are handled my Matlab / OOP in the transition from 2014a to 2016a as it’s working in the 2014a version?
Also, I’m going from 2014a to 2023b versions of Matlab. Is a ‘stop’ at the 2016a version before going to the 2023b version worth it?
Thanks ! oop, structures MATLAB Answers — New Questions
How do I configure an options file with multiple licenses?
I have multiple licenses for MATLAB that I run off of one license server. How do I direct my users to the appropriate license?I have multiple licenses for MATLAB that I run off of one license server. How do I direct my users to the appropriate license? I have multiple licenses for MATLAB that I run off of one license server. How do I direct my users to the appropriate license? MATLAB Answers — New Questions