Category: Matlab
Category Archives: Matlab
Custom loss function (based on error multiplication rather than sum) in classification neural network
Hi everyone,
First, thank you! This is a fantastic community from which I’m learning so much. This is my first question (hopefully, I’ll be able to contribute answers in the future!).
I have a system consisting of 10 elements, where each element can exist in one of four states (or classes). This means the system has 410410 possible states. For each element, I have 61 features that can be used to predict its state. I’ve experimented with different neural networks (FF networks have worked well so far), mainly focusing on predicting the labels of individual elements.
However, I’ve encountered some challenges:
The classes are naturally imbalanced.
The problem is non-deterministic, meaning two identical feature vectors can correspond to different labels.
I’ve been addressing these issues with relative success by applying techniques such as downsampling, oversampling, data augmentation, and soft labels (the latter has been the most effective).
Now, I want to predict the probability of the entire system being in each of its 410410 states. One issue I’ve noticed is that a misclassification error of 0.05 has minimal impact when the classification is close to random (e.g., 0.25), but it has a significant impact when probabilities are closer to 1 or 0.
What I’d like to do next is implement a loss function that considers the entire system rather than individual elements, while still being based on predictions for each element. My idea is to:
Take batches of 10 observations (corresponding to the 10 elements of the system).
Compute the probability of each element belonging to each of the 4 classes.
Calculate the probability of the system being in each of its 410410 possible states based on these predictions.
Sort these probabilities and use the known labels to find the index of the correct state.
Minimize this index.
Does this approach make sense? Is it feasible? And if so, how could it be implemented?
Many thanks!
DavidHi everyone,
First, thank you! This is a fantastic community from which I’m learning so much. This is my first question (hopefully, I’ll be able to contribute answers in the future!).
I have a system consisting of 10 elements, where each element can exist in one of four states (or classes). This means the system has 410410 possible states. For each element, I have 61 features that can be used to predict its state. I’ve experimented with different neural networks (FF networks have worked well so far), mainly focusing on predicting the labels of individual elements.
However, I’ve encountered some challenges:
The classes are naturally imbalanced.
The problem is non-deterministic, meaning two identical feature vectors can correspond to different labels.
I’ve been addressing these issues with relative success by applying techniques such as downsampling, oversampling, data augmentation, and soft labels (the latter has been the most effective).
Now, I want to predict the probability of the entire system being in each of its 410410 states. One issue I’ve noticed is that a misclassification error of 0.05 has minimal impact when the classification is close to random (e.g., 0.25), but it has a significant impact when probabilities are closer to 1 or 0.
What I’d like to do next is implement a loss function that considers the entire system rather than individual elements, while still being based on predictions for each element. My idea is to:
Take batches of 10 observations (corresponding to the 10 elements of the system).
Compute the probability of each element belonging to each of the 4 classes.
Calculate the probability of the system being in each of its 410410 possible states based on these predictions.
Sort these probabilities and use the known labels to find the index of the correct state.
Minimize this index.
Does this approach make sense? Is it feasible? And if so, how could it be implemented?
Many thanks!
David Hi everyone,
First, thank you! This is a fantastic community from which I’m learning so much. This is my first question (hopefully, I’ll be able to contribute answers in the future!).
I have a system consisting of 10 elements, where each element can exist in one of four states (or classes). This means the system has 410410 possible states. For each element, I have 61 features that can be used to predict its state. I’ve experimented with different neural networks (FF networks have worked well so far), mainly focusing on predicting the labels of individual elements.
However, I’ve encountered some challenges:
The classes are naturally imbalanced.
The problem is non-deterministic, meaning two identical feature vectors can correspond to different labels.
I’ve been addressing these issues with relative success by applying techniques such as downsampling, oversampling, data augmentation, and soft labels (the latter has been the most effective).
Now, I want to predict the probability of the entire system being in each of its 410410 states. One issue I’ve noticed is that a misclassification error of 0.05 has minimal impact when the classification is close to random (e.g., 0.25), but it has a significant impact when probabilities are closer to 1 or 0.
What I’d like to do next is implement a loss function that considers the entire system rather than individual elements, while still being based on predictions for each element. My idea is to:
Take batches of 10 observations (corresponding to the 10 elements of the system).
Compute the probability of each element belonging to each of the 4 classes.
Calculate the probability of the system being in each of its 410410 possible states based on these predictions.
Sort these probabilities and use the known labels to find the index of the correct state.
Minimize this index.
Does this approach make sense? Is it feasible? And if so, how could it be implemented?
Many thanks!
David neural network, classification, loss function, fast forward, trainnet MATLAB Answers — New Questions
What is the best practice for creating a recursion loop?
Hello all! I am trying to create a simple program that creates a fractal. It is supposed to be putting complex values into an array from the initial conditions and I will plot them later.
My Questions are:
1. What is the correct way to implement an Anonymous Function?
2. What is the best practice in Matlab for a recursion loop?
The answer to question 1 may not be necessary if the answer to 2 does not use Anonymous Functions.
clear all
clc
F = @(z) z^2 + c;
Re = [];
Im = [];
x = 1;
y = 1;
a = 2;
b = 3;
n = 10;
c = x+y*1i;
z0 = a+b*1i;
% Placing values in arrays to be plotted
Re(1,1) = real(z0 + c);
Im(1,1) = imag(z0 + c);
F(z0) = z; % First step of the recursion outside for loop?
% Second values for the array
Re(2,1) = real(z);
Im(2,1) = imag(z);
for h = (3:n) % Begin recursion
F(z) = z;
Re(h,1) = real(z);
Im(h,1) = imag(z);
h = h + 1;
endHello all! I am trying to create a simple program that creates a fractal. It is supposed to be putting complex values into an array from the initial conditions and I will plot them later.
My Questions are:
1. What is the correct way to implement an Anonymous Function?
2. What is the best practice in Matlab for a recursion loop?
The answer to question 1 may not be necessary if the answer to 2 does not use Anonymous Functions.
clear all
clc
F = @(z) z^2 + c;
Re = [];
Im = [];
x = 1;
y = 1;
a = 2;
b = 3;
n = 10;
c = x+y*1i;
z0 = a+b*1i;
% Placing values in arrays to be plotted
Re(1,1) = real(z0 + c);
Im(1,1) = imag(z0 + c);
F(z0) = z; % First step of the recursion outside for loop?
% Second values for the array
Re(2,1) = real(z);
Im(2,1) = imag(z);
for h = (3:n) % Begin recursion
F(z) = z;
Re(h,1) = real(z);
Im(h,1) = imag(z);
h = h + 1;
end Hello all! I am trying to create a simple program that creates a fractal. It is supposed to be putting complex values into an array from the initial conditions and I will plot them later.
My Questions are:
1. What is the correct way to implement an Anonymous Function?
2. What is the best practice in Matlab for a recursion loop?
The answer to question 1 may not be necessary if the answer to 2 does not use Anonymous Functions.
clear all
clc
F = @(z) z^2 + c;
Re = [];
Im = [];
x = 1;
y = 1;
a = 2;
b = 3;
n = 10;
c = x+y*1i;
z0 = a+b*1i;
% Placing values in arrays to be plotted
Re(1,1) = real(z0 + c);
Im(1,1) = imag(z0 + c);
F(z0) = z; % First step of the recursion outside for loop?
% Second values for the array
Re(2,1) = real(z);
Im(2,1) = imag(z);
for h = (3:n) % Begin recursion
F(z) = z;
Re(h,1) = real(z);
Im(h,1) = imag(z);
h = h + 1;
end anonymous function, recursion, fractal MATLAB Answers — New Questions
ROS Logger doesn’t show the topics
I am working with MATLAB R2024b on a Simulink model. I want to publish some topics using ROS2. I added some topics in different place of the model, one of them is at depth 1 from the main system and the rest are at depth 5-6 from the main system (as shown in the 2 images). When I use ROS Logger to create a ROS bag, it only show the one topic at depth 1. I have chosen "Log Selected Signal" to all of the Topic. I am not sure if subsytem depth is the reason, but I need to create a log file for all topics. There is a same discussion, but no solution is shown there.
Depth 1 topic:
Depth 5 topic:
Can you suggest the solution?I am working with MATLAB R2024b on a Simulink model. I want to publish some topics using ROS2. I added some topics in different place of the model, one of them is at depth 1 from the main system and the rest are at depth 5-6 from the main system (as shown in the 2 images). When I use ROS Logger to create a ROS bag, it only show the one topic at depth 1. I have chosen "Log Selected Signal" to all of the Topic. I am not sure if subsytem depth is the reason, but I need to create a log file for all topics. There is a same discussion, but no solution is shown there.
Depth 1 topic:
Depth 5 topic:
Can you suggest the solution? I am working with MATLAB R2024b on a Simulink model. I want to publish some topics using ROS2. I added some topics in different place of the model, one of them is at depth 1 from the main system and the rest are at depth 5-6 from the main system (as shown in the 2 images). When I use ROS Logger to create a ROS bag, it only show the one topic at depth 1. I have chosen "Log Selected Signal" to all of the Topic. I am not sure if subsytem depth is the reason, but I need to create a log file for all topics. There is a same discussion, but no solution is shown there.
Depth 1 topic:
Depth 5 topic:
Can you suggest the solution? ros2, simulink, ros-logger MATLAB Answers — New Questions
Error on Symbolic calculation : “Empty sym : 0-by-1”
I need the help of people who have excellent talents in calculating using Matlab.
The equations to be implemented through Matlab coding is as follows.
The results to be obtained through this coding is written in "Answer) ~" above.
And, the data related to this problem(or eqution) is below.
I have tried with the following coding but kept getting the same results as the title. I would like to get helpful advice on this part.
I would appreciate it if you could give me a guide on the solution or error cause.
v1 = [393 393 393 393 393 393 393 393 393 393 ; 3850 4340 4760 5320 5740 6160 6580 7140 7980 8960];
v2 = [408 408 408 408 408 408 408 408 408 408 ; 3300 3720 4080 4560 4920 5280 5640 6120 6840 7680];
v3 = [423 423 423 423 423 423 423 423 423 423 ; 2750 3100 3400 3800 4100 4400 4700 5100 5700 6400];
syms B; % parameter Beta
syms BB; % parameter B
syms C;
%————- equation 1 ————-%
a1_v1 = 0;
a1_v2 = 0;
a1_v3 = 0;
i = 1; % "Stress Lv. 1" in the second term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
a1_v1 = N*log(v1(i+1,j)/C/exp(BB/v1(i,j))) + a1_v1;
end
i = 1; % "Stress Lv. 2" in the second term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
a1_v2 = N*log(v2(i+1,j)/C/exp(BB/v2(i,j))) + a1_v2;
end
i = 1; % "Stress Lv. 3" in the second term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
a1_v3 = N*log(v3(i+1,j)/C/exp(BB/v3(i,j))) + a1_v3;
end
a2_v1 = 0;
a2_v2 = 0;
a2_v3 = 0;
i = 1; % "Stress Lv. 1" in the third term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
a2_v1 = N*(v1(i+1,j)/C/exp(BB/v1(i,j)))^B*log(v1(i+1,j)/C/exp(BB/v1(i,j))) + a2_v1;
end
i = 1; % "Stress Lv. 2" in the third term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
a2_v2 = N*(v2(i+1,j)/C/exp(BB/v2(i,j)))^B*log(v2(i+1,j)/C/exp(BB/v2(i,j))) + a2_v2;
end
i = 1; % "Stress Lv. 3" in the third term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
a2_v3 = N*(v3(i+1,j)/C/exp(BB/v3(i,j)))^B*log(v3(i+1,j)/C/exp(BB/v3(i,j))) + a2_v3;
end
a1 = a1_v1 + a1_v2 + a1_v3;
a2 = a2_v1 + a2_v2 + a2_v3;
N = numel(v1(1,:)) + numel(v2(1,:))+ numel(v3(1,:)); % the first term of ∂Λ/∂β(equation 1)
one = N/B + a1 – a2;
%————- equation 2 ————-%
b1_v1 = 0;
b1_v2 = 0;
b1_v3 = 0;
i = 1; % "Stress Lv. 1" in the first term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
b1_v1 = N/v1(i,j) + b1_v1;
end
i = 1; % "Stress Lv. 2" in the first term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
b1_v2 = N/v2(i,j) + b1_v2;
end
i = 1; % "Stress Lv. 3" in the first term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
b1_v3 = N/v3(i,j) + b1_v3;
end
b2_v1 = 0;
b2_v2 = 0;
b2_v3 = 0;
i = 1; % "Stress Lv. 1" in the second term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
b2_v1 = N/v1(i,j)*(v1(i+1,j)/C/exp(BB/v1(i,j)))^B+b2_v1;
end
i = 1; % "Stress Lv. 2" in the second term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
b2_v2 = N/v2(i,j)*(v2(i+1,j)/C/exp(BB/v2(i,j)))^B+b2_v2;
end
i = 1; % "Stress Lv. 3" in the second term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
b2_v3 = N/v3(i,j)*(v3(i+1,j)/C/exp(BB/v3(i,j)))^B+b2_v3;
end
b1 = b1_v1 + b1_v2 + b1_v3;
b2 = b2_v1 + b2_v2 + b2_v3;
two = B*(- b1 + b2);
%————- equation 3 ————-%
c1 = 0;
c2 = 0;
c3 = 0;
i = 1; % "Stress Lv. 1" in the second term of ∂Λ/∂C(equation 3)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
c1 = N*(v1(i+1,j)/C/exp(BB/v1(i,j)))^B+c1;
end
i = 1; % "Stress Lv. 2" in the second term of ∂Λ/∂C(equation 3)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
c2 = N*(v2(i+1,j)/C/exp(BB/v2(i,j)))^B+c2;
end
i = 1; % "Stress Lv. 3" in the second term of ∂Λ/∂C(equation 3)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
c3 = N*(v3(i+1,j)/C/exp(BB/v3(i,j)))^B+c3;
end
N = numel(v1(1,:)) + numel(v2(1,:)) + numel(v3(1,:)); % the first term of ∂Λ/∂C(equation 3)
three = B/C*(- N + (c1 + c2 + c3));
eqns = [one == 0, two == 0, three == 0];
vars = [B BB C];
answer = solve(eqns, vars);
vpa(answer.B)
vpa(answer.BB)
vpa(answer.C)I need the help of people who have excellent talents in calculating using Matlab.
The equations to be implemented through Matlab coding is as follows.
The results to be obtained through this coding is written in "Answer) ~" above.
And, the data related to this problem(or eqution) is below.
I have tried with the following coding but kept getting the same results as the title. I would like to get helpful advice on this part.
I would appreciate it if you could give me a guide on the solution or error cause.
v1 = [393 393 393 393 393 393 393 393 393 393 ; 3850 4340 4760 5320 5740 6160 6580 7140 7980 8960];
v2 = [408 408 408 408 408 408 408 408 408 408 ; 3300 3720 4080 4560 4920 5280 5640 6120 6840 7680];
v3 = [423 423 423 423 423 423 423 423 423 423 ; 2750 3100 3400 3800 4100 4400 4700 5100 5700 6400];
syms B; % parameter Beta
syms BB; % parameter B
syms C;
%————- equation 1 ————-%
a1_v1 = 0;
a1_v2 = 0;
a1_v3 = 0;
i = 1; % "Stress Lv. 1" in the second term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
a1_v1 = N*log(v1(i+1,j)/C/exp(BB/v1(i,j))) + a1_v1;
end
i = 1; % "Stress Lv. 2" in the second term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
a1_v2 = N*log(v2(i+1,j)/C/exp(BB/v2(i,j))) + a1_v2;
end
i = 1; % "Stress Lv. 3" in the second term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
a1_v3 = N*log(v3(i+1,j)/C/exp(BB/v3(i,j))) + a1_v3;
end
a2_v1 = 0;
a2_v2 = 0;
a2_v3 = 0;
i = 1; % "Stress Lv. 1" in the third term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
a2_v1 = N*(v1(i+1,j)/C/exp(BB/v1(i,j)))^B*log(v1(i+1,j)/C/exp(BB/v1(i,j))) + a2_v1;
end
i = 1; % "Stress Lv. 2" in the third term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
a2_v2 = N*(v2(i+1,j)/C/exp(BB/v2(i,j)))^B*log(v2(i+1,j)/C/exp(BB/v2(i,j))) + a2_v2;
end
i = 1; % "Stress Lv. 3" in the third term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
a2_v3 = N*(v3(i+1,j)/C/exp(BB/v3(i,j)))^B*log(v3(i+1,j)/C/exp(BB/v3(i,j))) + a2_v3;
end
a1 = a1_v1 + a1_v2 + a1_v3;
a2 = a2_v1 + a2_v2 + a2_v3;
N = numel(v1(1,:)) + numel(v2(1,:))+ numel(v3(1,:)); % the first term of ∂Λ/∂β(equation 1)
one = N/B + a1 – a2;
%————- equation 2 ————-%
b1_v1 = 0;
b1_v2 = 0;
b1_v3 = 0;
i = 1; % "Stress Lv. 1" in the first term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
b1_v1 = N/v1(i,j) + b1_v1;
end
i = 1; % "Stress Lv. 2" in the first term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
b1_v2 = N/v2(i,j) + b1_v2;
end
i = 1; % "Stress Lv. 3" in the first term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
b1_v3 = N/v3(i,j) + b1_v3;
end
b2_v1 = 0;
b2_v2 = 0;
b2_v3 = 0;
i = 1; % "Stress Lv. 1" in the second term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
b2_v1 = N/v1(i,j)*(v1(i+1,j)/C/exp(BB/v1(i,j)))^B+b2_v1;
end
i = 1; % "Stress Lv. 2" in the second term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
b2_v2 = N/v2(i,j)*(v2(i+1,j)/C/exp(BB/v2(i,j)))^B+b2_v2;
end
i = 1; % "Stress Lv. 3" in the second term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
b2_v3 = N/v3(i,j)*(v3(i+1,j)/C/exp(BB/v3(i,j)))^B+b2_v3;
end
b1 = b1_v1 + b1_v2 + b1_v3;
b2 = b2_v1 + b2_v2 + b2_v3;
two = B*(- b1 + b2);
%————- equation 3 ————-%
c1 = 0;
c2 = 0;
c3 = 0;
i = 1; % "Stress Lv. 1" in the second term of ∂Λ/∂C(equation 3)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
c1 = N*(v1(i+1,j)/C/exp(BB/v1(i,j)))^B+c1;
end
i = 1; % "Stress Lv. 2" in the second term of ∂Λ/∂C(equation 3)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
c2 = N*(v2(i+1,j)/C/exp(BB/v2(i,j)))^B+c2;
end
i = 1; % "Stress Lv. 3" in the second term of ∂Λ/∂C(equation 3)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
c3 = N*(v3(i+1,j)/C/exp(BB/v3(i,j)))^B+c3;
end
N = numel(v1(1,:)) + numel(v2(1,:)) + numel(v3(1,:)); % the first term of ∂Λ/∂C(equation 3)
three = B/C*(- N + (c1 + c2 + c3));
eqns = [one == 0, two == 0, three == 0];
vars = [B BB C];
answer = solve(eqns, vars);
vpa(answer.B)
vpa(answer.BB)
vpa(answer.C) I need the help of people who have excellent talents in calculating using Matlab.
The equations to be implemented through Matlab coding is as follows.
The results to be obtained through this coding is written in "Answer) ~" above.
And, the data related to this problem(or eqution) is below.
I have tried with the following coding but kept getting the same results as the title. I would like to get helpful advice on this part.
I would appreciate it if you could give me a guide on the solution or error cause.
v1 = [393 393 393 393 393 393 393 393 393 393 ; 3850 4340 4760 5320 5740 6160 6580 7140 7980 8960];
v2 = [408 408 408 408 408 408 408 408 408 408 ; 3300 3720 4080 4560 4920 5280 5640 6120 6840 7680];
v3 = [423 423 423 423 423 423 423 423 423 423 ; 2750 3100 3400 3800 4100 4400 4700 5100 5700 6400];
syms B; % parameter Beta
syms BB; % parameter B
syms C;
%————- equation 1 ————-%
a1_v1 = 0;
a1_v2 = 0;
a1_v3 = 0;
i = 1; % "Stress Lv. 1" in the second term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
a1_v1 = N*log(v1(i+1,j)/C/exp(BB/v1(i,j))) + a1_v1;
end
i = 1; % "Stress Lv. 2" in the second term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
a1_v2 = N*log(v2(i+1,j)/C/exp(BB/v2(i,j))) + a1_v2;
end
i = 1; % "Stress Lv. 3" in the second term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
a1_v3 = N*log(v3(i+1,j)/C/exp(BB/v3(i,j))) + a1_v3;
end
a2_v1 = 0;
a2_v2 = 0;
a2_v3 = 0;
i = 1; % "Stress Lv. 1" in the third term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
a2_v1 = N*(v1(i+1,j)/C/exp(BB/v1(i,j)))^B*log(v1(i+1,j)/C/exp(BB/v1(i,j))) + a2_v1;
end
i = 1; % "Stress Lv. 2" in the third term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
a2_v2 = N*(v2(i+1,j)/C/exp(BB/v2(i,j)))^B*log(v2(i+1,j)/C/exp(BB/v2(i,j))) + a2_v2;
end
i = 1; % "Stress Lv. 3" in the third term of ∂Λ/∂β(equation 1)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
a2_v3 = N*(v3(i+1,j)/C/exp(BB/v3(i,j)))^B*log(v3(i+1,j)/C/exp(BB/v3(i,j))) + a2_v3;
end
a1 = a1_v1 + a1_v2 + a1_v3;
a2 = a2_v1 + a2_v2 + a2_v3;
N = numel(v1(1,:)) + numel(v2(1,:))+ numel(v3(1,:)); % the first term of ∂Λ/∂β(equation 1)
one = N/B + a1 – a2;
%————- equation 2 ————-%
b1_v1 = 0;
b1_v2 = 0;
b1_v3 = 0;
i = 1; % "Stress Lv. 1" in the first term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
b1_v1 = N/v1(i,j) + b1_v1;
end
i = 1; % "Stress Lv. 2" in the first term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
b1_v2 = N/v2(i,j) + b1_v2;
end
i = 1; % "Stress Lv. 3" in the first term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
b1_v3 = N/v3(i,j) + b1_v3;
end
b2_v1 = 0;
b2_v2 = 0;
b2_v3 = 0;
i = 1; % "Stress Lv. 1" in the second term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
b2_v1 = N/v1(i,j)*(v1(i+1,j)/C/exp(BB/v1(i,j)))^B+b2_v1;
end
i = 1; % "Stress Lv. 2" in the second term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
b2_v2 = N/v2(i,j)*(v2(i+1,j)/C/exp(BB/v2(i,j)))^B+b2_v2;
end
i = 1; % "Stress Lv. 3" in the second term of ∂Λ/∂B(equation 2)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
b2_v3 = N/v3(i,j)*(v3(i+1,j)/C/exp(BB/v3(i,j)))^B+b2_v3;
end
b1 = b1_v1 + b1_v2 + b1_v3;
b2 = b2_v1 + b2_v2 + b2_v3;
two = B*(- b1 + b2);
%————- equation 3 ————-%
c1 = 0;
c2 = 0;
c3 = 0;
i = 1; % "Stress Lv. 1" in the second term of ∂Λ/∂C(equation 3)
for j = 1:(numel(v1(i, :)))
N = numel(v1(i,j));
c1 = N*(v1(i+1,j)/C/exp(BB/v1(i,j)))^B+c1;
end
i = 1; % "Stress Lv. 2" in the second term of ∂Λ/∂C(equation 3)
for j = 1:(numel(v2(i, :)))
N = numel(v2(i,j));
c2 = N*(v2(i+1,j)/C/exp(BB/v2(i,j)))^B+c2;
end
i = 1; % "Stress Lv. 3" in the second term of ∂Λ/∂C(equation 3)
for j = 1:(numel(v3(i, :)))
N = numel(v3(i,j));
c3 = N*(v3(i+1,j)/C/exp(BB/v3(i,j)))^B+c3;
end
N = numel(v1(1,:)) + numel(v2(1,:)) + numel(v3(1,:)); % the first term of ∂Λ/∂C(equation 3)
three = B/C*(- N + (c1 + c2 + c3));
eqns = [one == 0, two == 0, three == 0];
vars = [B BB C];
answer = solve(eqns, vars);
vpa(answer.B)
vpa(answer.BB)
vpa(answer.C) vpa, equation, 0-by-1, threeparameteres, solve, stresslevel MATLAB Answers — New Questions
Different answers each run halving step size, debugging code correctly
Hello,
I have a code computing a rockets trajectory using Rungekutta. The issue is computing error, I am trying to compute and estimated global error, by comparing two results with different step size. There is a while loop in the code, which halves the step size to compute local truncation error and minimize this. However, I descided to deactivate this, so the issue is not here. I have tried to search trough the code various times, but I can not seem to find an issue anywhere.
Any help is greatly appriciatedHello,
I have a code computing a rockets trajectory using Rungekutta. The issue is computing error, I am trying to compute and estimated global error, by comparing two results with different step size. There is a while loop in the code, which halves the step size to compute local truncation error and minimize this. However, I descided to deactivate this, so the issue is not here. I have tried to search trough the code various times, but I can not seem to find an issue anywhere.
Any help is greatly appriciated Hello,
I have a code computing a rockets trajectory using Rungekutta. The issue is computing error, I am trying to compute and estimated global error, by comparing two results with different step size. There is a while loop in the code, which halves the step size to compute local truncation error and minimize this. However, I descided to deactivate this, so the issue is not here. I have tried to search trough the code various times, but I can not seem to find an issue anywhere.
Any help is greatly appriciated runge-kutta, ode, rocket trajectory MATLAB Answers — New Questions
Detecting a serial port valid after disconnect/reconnect
I asked before with a long question and got no answers, so let’s keep it simpler.
Serial port is connected to Arduino
Arduino resets, so I need to:
1. Detect that it’s gone without throwing an error
2. Reconnect
Results:
Connected and callback set
K>> app.Pico
ans =
Serialport with properties:
Port: "COM16"
BaudRate: 57600
NumBytesAvailable: 0
Hit reset on Pico get following error message ( but it doesn’t stop my program from running)
Unable to detect connection to the serialport device. Ensure that the device is plugged in and create a new serialport object.
If there is no "keep alive" function for serial ports ( Walter Roberson in https://www.mathworks.com/matlabcentral/answers/1722140-cant-read-the-serial-port) then what is generating this error? How can I catch it without constantly checking the connection myself?
If I could trap the error here that would be a great start.
So let’s look at where we are:
K>> app.PicoCom
ans =
Serialport with properties:
In ‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for parameter {0}.
Not useful, but I can check it right?
K>> isvalid(app.PicoCom)
ans =
logical
1
Really? It’s still valid? Let’s try
K>> serialportlist("available")
ans =
1×2 string array
"COM1" "COM16"
OK, at least I can see it’s back in the list of available ports. Is this the best (fastest) way to find out?
Also I can’t check in the input call back because then it’s too late. Error thrown already.
K>> delete(app.PicoCom)
K>> app.PicoCom
ans =
handle to deleted Serialport
K>> isvalid(app.PicoCom)
ans =
logical
0
At least once deleted it’s not valid. Let’s reconnect:
K>> app.PicoCom = serialport()
K>> app.PicoCom
ans =
Serialport with properties:
Port: "COM16"
BaudRate: 57600
NumBytesAvailable: 0
ByteOrder: "little-endian"
DataBits: 8
StopBits: 1
Parity: "none"
FlowControl: "none"
Timeout: 10
Terminator: "CR/LF"
Back to normal as soon as I add
K>> configureCallback(app.PicoCom,"terminator",@app.PicoInput);
So I think I’ve got recovery OK. How about detecting when coms are lost?
BTW serialportfind is only useful when teh prot is there. If it’s missing then looking throws an error…
K>> serialportfind
ans =
Serialport with properties:
In ‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for parameter {0}.
Apparently it’s a valid question to ask, just not a useful answer.
K>> isvalid(serialportfind)’
ans =
logical
1I asked before with a long question and got no answers, so let’s keep it simpler.
Serial port is connected to Arduino
Arduino resets, so I need to:
1. Detect that it’s gone without throwing an error
2. Reconnect
Results:
Connected and callback set
K>> app.Pico
ans =
Serialport with properties:
Port: "COM16"
BaudRate: 57600
NumBytesAvailable: 0
Hit reset on Pico get following error message ( but it doesn’t stop my program from running)
Unable to detect connection to the serialport device. Ensure that the device is plugged in and create a new serialport object.
If there is no "keep alive" function for serial ports ( Walter Roberson in https://www.mathworks.com/matlabcentral/answers/1722140-cant-read-the-serial-port) then what is generating this error? How can I catch it without constantly checking the connection myself?
If I could trap the error here that would be a great start.
So let’s look at where we are:
K>> app.PicoCom
ans =
Serialport with properties:
In ‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for parameter {0}.
Not useful, but I can check it right?
K>> isvalid(app.PicoCom)
ans =
logical
1
Really? It’s still valid? Let’s try
K>> serialportlist("available")
ans =
1×2 string array
"COM1" "COM16"
OK, at least I can see it’s back in the list of available ports. Is this the best (fastest) way to find out?
Also I can’t check in the input call back because then it’s too late. Error thrown already.
K>> delete(app.PicoCom)
K>> app.PicoCom
ans =
handle to deleted Serialport
K>> isvalid(app.PicoCom)
ans =
logical
0
At least once deleted it’s not valid. Let’s reconnect:
K>> app.PicoCom = serialport()
K>> app.PicoCom
ans =
Serialport with properties:
Port: "COM16"
BaudRate: 57600
NumBytesAvailable: 0
ByteOrder: "little-endian"
DataBits: 8
StopBits: 1
Parity: "none"
FlowControl: "none"
Timeout: 10
Terminator: "CR/LF"
Back to normal as soon as I add
K>> configureCallback(app.PicoCom,"terminator",@app.PicoInput);
So I think I’ve got recovery OK. How about detecting when coms are lost?
BTW serialportfind is only useful when teh prot is there. If it’s missing then looking throws an error…
K>> serialportfind
ans =
Serialport with properties:
In ‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for parameter {0}.
Apparently it’s a valid question to ask, just not a useful answer.
K>> isvalid(serialportfind)’
ans =
logical
1 I asked before with a long question and got no answers, so let’s keep it simpler.
Serial port is connected to Arduino
Arduino resets, so I need to:
1. Detect that it’s gone without throwing an error
2. Reconnect
Results:
Connected and callback set
K>> app.Pico
ans =
Serialport with properties:
Port: "COM16"
BaudRate: 57600
NumBytesAvailable: 0
Hit reset on Pico get following error message ( but it doesn’t stop my program from running)
Unable to detect connection to the serialport device. Ensure that the device is plugged in and create a new serialport object.
If there is no "keep alive" function for serial ports ( Walter Roberson in https://www.mathworks.com/matlabcentral/answers/1722140-cant-read-the-serial-port) then what is generating this error? How can I catch it without constantly checking the connection myself?
If I could trap the error here that would be a great start.
So let’s look at where we are:
K>> app.PicoCom
ans =
Serialport with properties:
In ‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for parameter {0}.
Not useful, but I can check it right?
K>> isvalid(app.PicoCom)
ans =
logical
1
Really? It’s still valid? Let’s try
K>> serialportlist("available")
ans =
1×2 string array
"COM1" "COM16"
OK, at least I can see it’s back in the list of available ports. Is this the best (fastest) way to find out?
Also I can’t check in the input call back because then it’s too late. Error thrown already.
K>> delete(app.PicoCom)
K>> app.PicoCom
ans =
handle to deleted Serialport
K>> isvalid(app.PicoCom)
ans =
logical
0
At least once deleted it’s not valid. Let’s reconnect:
K>> app.PicoCom = serialport()
K>> app.PicoCom
ans =
Serialport with properties:
Port: "COM16"
BaudRate: 57600
NumBytesAvailable: 0
ByteOrder: "little-endian"
DataBits: 8
StopBits: 1
Parity: "none"
FlowControl: "none"
Timeout: 10
Terminator: "CR/LF"
Back to normal as soon as I add
K>> configureCallback(app.PicoCom,"terminator",@app.PicoInput);
So I think I’ve got recovery OK. How about detecting when coms are lost?
BTW serialportfind is only useful when teh prot is there. If it’s missing then looking throws an error…
K>> serialportfind
ans =
Serialport with properties:
In ‘testmeaslib:CustomDisplay:PropertyWarning’,
data type supplied is incorrect for parameter {0}.
Apparently it’s a valid question to ask, just not a useful answer.
K>> isvalid(serialportfind)’
ans =
logical
1 serial, usb, reconnect MATLAB Answers — New Questions
App Designer 2024b broken
I was fine using AD in 2023b but now with 2024b I’m finding weird things. Asking if anyone else has seen these issues. (I also reported to ML Help)
Save As to change the file name to a new version pops up an error about another program opening the file (non existant) and then crashes when reopening. Always at 10% it stops reloading for more time that I want to wait. Usually loads in less than a minute, I let this run for 10.
It seems to have randomly corrupted my column widths that were set long ago. Changing with to auto with values that don’t work on the GUI screen. I had this working 10 versions ago and now it decides to corrupt my settings?I was fine using AD in 2023b but now with 2024b I’m finding weird things. Asking if anyone else has seen these issues. (I also reported to ML Help)
Save As to change the file name to a new version pops up an error about another program opening the file (non existant) and then crashes when reopening. Always at 10% it stops reloading for more time that I want to wait. Usually loads in less than a minute, I let this run for 10.
It seems to have randomly corrupted my column widths that were set long ago. Changing with to auto with values that don’t work on the GUI screen. I had this working 10 versions ago and now it decides to corrupt my settings? I was fine using AD in 2023b but now with 2024b I’m finding weird things. Asking if anyone else has seen these issues. (I also reported to ML Help)
Save As to change the file name to a new version pops up an error about another program opening the file (non existant) and then crashes when reopening. Always at 10% it stops reloading for more time that I want to wait. Usually loads in less than a minute, I let this run for 10.
It seems to have randomly corrupted my column widths that were set long ago. Changing with to auto with values that don’t work on the GUI screen. I had this working 10 versions ago and now it decides to corrupt my settings? ad broken MATLAB Answers — New Questions
How can I keep my app in front on the screen?
When certain functions are called such as uigetfile() or uigetdir() after the file or directory is chosen the AD generated app goes behind other windows that may be on the screen. How can I bring it back to the front?
figure(app.MyApp);
didn’t work.
Also pressing enter rather than mouse clicking to get the default can result in the next popup query [ uiconfirm() or uigetfile() ] coming up behind the application and thus not responding to the enter key. Focus has been lost!When certain functions are called such as uigetfile() or uigetdir() after the file or directory is chosen the AD generated app goes behind other windows that may be on the screen. How can I bring it back to the front?
figure(app.MyApp);
didn’t work.
Also pressing enter rather than mouse clicking to get the default can result in the next popup query [ uiconfirm() or uigetfile() ] coming up behind the application and thus not responding to the enter key. Focus has been lost! When certain functions are called such as uigetfile() or uigetdir() after the file or directory is chosen the AD generated app goes behind other windows that may be on the screen. How can I bring it back to the front?
figure(app.MyApp);
didn’t work.
Also pressing enter rather than mouse clicking to get the default can result in the next popup query [ uiconfirm() or uigetfile() ] coming up behind the application and thus not responding to the enter key. Focus has been lost! focus, move to front MATLAB Answers — New Questions
Populate drop down menus with enums
Hello all,
I trying to understand enumerations and how they are to be used in matlab. I have 2 questions:
1.: In C# I can just define enums in a class:
enum someSpecificValues { one = 1, two = 2, three = 3 }:
And later use them
var enumTest = someSpeficValues.one;
Now, what I understood from the MATLAB help is that I need to define each enum as a class and then call that from within my class. I am developing a driver library, where I need a couple of settings as enums. Do I really need to define them in that way or is there a way to define them within the class? Creating them inside the class has the added advantage that they’re confined to the class, where they make sense.
2.: Along with my driver I’d like to create some examples in the app creator, where I want to display these enumerated values as drop down menus, so people don’t just enter random values. Is there a way to link the drop down to the enumeration or would I have to write the values by hand and hope not to make an error? Again, in C# you could bind the drop down to the enum (technically, you’d bind to the list, but the effect is the same) and changes to the enum would be reflected on your UI.
I have tried to use the DropDown.Items property and realized this accepts string arrays and not enumerations. I don’t know how to correctly convert my enumeration, though. Suppose I have the class:
classdef readModes
enumeration
ZIF, SH, SHN, HDR, DD
end
end
Then the following would not work.
app.DropDown.Items = enumeration(readModes.ZIF);
But what does?Hello all,
I trying to understand enumerations and how they are to be used in matlab. I have 2 questions:
1.: In C# I can just define enums in a class:
enum someSpecificValues { one = 1, two = 2, three = 3 }:
And later use them
var enumTest = someSpeficValues.one;
Now, what I understood from the MATLAB help is that I need to define each enum as a class and then call that from within my class. I am developing a driver library, where I need a couple of settings as enums. Do I really need to define them in that way or is there a way to define them within the class? Creating them inside the class has the added advantage that they’re confined to the class, where they make sense.
2.: Along with my driver I’d like to create some examples in the app creator, where I want to display these enumerated values as drop down menus, so people don’t just enter random values. Is there a way to link the drop down to the enumeration or would I have to write the values by hand and hope not to make an error? Again, in C# you could bind the drop down to the enum (technically, you’d bind to the list, but the effect is the same) and changes to the enum would be reflected on your UI.
I have tried to use the DropDown.Items property and realized this accepts string arrays and not enumerations. I don’t know how to correctly convert my enumeration, though. Suppose I have the class:
classdef readModes
enumeration
ZIF, SH, SHN, HDR, DD
end
end
Then the following would not work.
app.DropDown.Items = enumeration(readModes.ZIF);
But what does? Hello all,
I trying to understand enumerations and how they are to be used in matlab. I have 2 questions:
1.: In C# I can just define enums in a class:
enum someSpecificValues { one = 1, two = 2, three = 3 }:
And later use them
var enumTest = someSpeficValues.one;
Now, what I understood from the MATLAB help is that I need to define each enum as a class and then call that from within my class. I am developing a driver library, where I need a couple of settings as enums. Do I really need to define them in that way or is there a way to define them within the class? Creating them inside the class has the added advantage that they’re confined to the class, where they make sense.
2.: Along with my driver I’d like to create some examples in the app creator, where I want to display these enumerated values as drop down menus, so people don’t just enter random values. Is there a way to link the drop down to the enumeration or would I have to write the values by hand and hope not to make an error? Again, in C# you could bind the drop down to the enum (technically, you’d bind to the list, but the effect is the same) and changes to the enum would be reflected on your UI.
I have tried to use the DropDown.Items property and realized this accepts string arrays and not enumerations. I don’t know how to correctly convert my enumeration, though. Suppose I have the class:
classdef readModes
enumeration
ZIF, SH, SHN, HDR, DD
end
end
Then the following would not work.
app.DropDown.Items = enumeration(readModes.ZIF);
But what does? matlab, app designer, enumeration, oop MATLAB Answers — New Questions
Matlab R2024a Startup Segmentation Fault (Linux)
Since upgrading from Matlab R2021a to R2024a, I am consistently seeing deadlocks and segmentation faults when starting matlab in -batch mode
OS: Rocky Linux 8 (or 9)
Other command line arguments – matlab -nosplash -nodesktop -noFigureWindows -timing -sd /home/simuser -logfile /home/simuser/jobRunner.log -batch "disp(‘hello-world’);pause(10);disp(‘hello-world’);"
Fault Count: 1
Abnormal termination:
Segmentation violation
Current Thread: ‘ED 0 dispatch t’ id 22415512651520
Register State (from fault):
RAX = 000000001100fe46 RBX = 0000146304ab2290
RCX = 00001465d51eb6e0 RDX = 0000110969f00000
RSP = 0000146304ab2248 RBP = 0000146304ab2250
RSI = 0000146304ab2350 RDI = 00000000110b6c80
R8 = 0000000000000000 R9 = 0000000000000000
R10 = 0000000000000000 R11 = 0000000000000001
R12 = 00001465d508f260 R13 = 0000146304ab2350
R14 = 0000146304ab2270 R15 = 00001465b4460a40
RIP = 0000110969f00000 EFL = 0000000000010283
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x0000110969f00000 <unknown-module>+00000000
[ 1] 0x00001465d521c7a6 /usr/local/matlab/R2024a/bin/glnxa64/libmwfoundation_matlabdata.so+00792486 _ZNK10foundation10matlabdata5Array7getTypeEv+00000038
[ 2] 0x00001465d4f8c0ce /usr/local/matlab/R2024a/bin/glnxa64/libmwsettingscore.so+02400462
[ 3] 0x00001465d4f1c244 /usr/local/matlab/R2024a/bin/glnxa64/libmwsettingscore.so+01942084 _ZNK8settings4core8Settings3getIbEEN7mwboost16remove_referenceIT_E4typeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESF_+00000052
[ 4] 0x00001465681cfbfd /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpproxy/matlab/httpproxy/libmwmatlabhttpproxy.so+00035837
[ 5] 0x00001465b20b2820 /usr/local/matlab/R2024a/bin/glnxa64/matlab_startup_plugins/cefclient/../../../../bin/glnxa64/libmwflhttpproxy.so+00043040
[ 6] 0x00001465681d2756 /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpproxy/matlab/httpproxy/libmwmatlabhttpproxy.so+00046934
[ 7] 0x00001465683c6e29 /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpclient/foundation/httpclient_core/implementation/mwhttpclient_core_implementation.so+01121833
[ 8] 0x00001465683ce3cc /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpclient/foundation/httpclient_core/implementation/mwhttpclient_core_implementation.so+01151948
[ 9] 0x00001465cd17102d /usr/local/matlab/R2024a/bin/glnxa64/factory_settings/project/settings/../../../../../bin/glnxa64/libmwflhttpclient_core.so+00135213 _ZNK10foundation15httpclient_core10HttpClient11makeRequestENS0_11HttpRequestE+00000189
[ 10] 0x00001465b1bd63ed /usr/local/matlab/R2024a/bin/glnxa64/matlab_startup_plugins/jmi/../../../../bin/glnxa64/libmwxmlutils.so+00091117 _ZN2mw8xmlutils12LibXML2Utils22readDOMDocumentFromUrlERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+00002173
[ 11] 0x000014656930f8f3 /usr/local/matlab/R2024a/bin/glnxa64/registration_framework_plugins/addons/core_reg_point_api_impl/../../../../../bin/glnxa64/libmwaddons_registry_core.so+00780531 _ZN6addons8registry17MetadataFileUtils38getPreviewImageUrlUsingMetadataFileUrlERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+00000147
[ 12] 0x000014630126d80f /usr/local/matlab/R2024a/bin/glnxa64/libaddons_registry_jni.so+00018447 Java_com_mathworks_addons_1registry_MetadataFileUtils_1Jni_getPreviewImageUrlUsingURL_1Native+00000095
[ 13] 0x00001464f50186c7 <unknown-module>+00000000
[ 14] 0x00001464f5008040 <unknown-module>+00000000
[ 15] 0x00001464f5008040 <unknown-module>+00000000
[ 16] 0x00001464f5008040 <unknown-module>+00000000
[ 17] 0x00001464f5008040 <unknown-module>+00000000
[ 18] 0x00001464f5008040 <unknown-module>+00000000
[ 19] 0x00001464f5c59e4c <unknown-module>+00000000
[ 20] 0x00001464f50082bd <unknown-module>+00000000
[ 21] 0x00001464f5008302 <unknown-module>+00000000
[ 22] 0x00001464f50007a7 <unknown-module>+00000000
[ 23] 0x000014656ac9b39b /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06849435
[ 24] 0x000014656ac98c63 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06839395
[ 25] 0x000014656ac99227 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06840871
[ 26] 0x000014656ad0539c /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07283612
[ 27] 0x000014656b08e9eb /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992107
[ 28] 0x000014656b08ecf1 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992881
[ 29] 0x000014656af208c2 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09492674
[ 30] 0x00001465d69731ca /lib64/libpthread.so.0+00033226
[ 31] 0x00001465d63dc8d3 /lib64/libc.so.6+00235731 clone+00000067Since upgrading from Matlab R2021a to R2024a, I am consistently seeing deadlocks and segmentation faults when starting matlab in -batch mode
OS: Rocky Linux 8 (or 9)
Other command line arguments – matlab -nosplash -nodesktop -noFigureWindows -timing -sd /home/simuser -logfile /home/simuser/jobRunner.log -batch "disp(‘hello-world’);pause(10);disp(‘hello-world’);"
Fault Count: 1
Abnormal termination:
Segmentation violation
Current Thread: ‘ED 0 dispatch t’ id 22415512651520
Register State (from fault):
RAX = 000000001100fe46 RBX = 0000146304ab2290
RCX = 00001465d51eb6e0 RDX = 0000110969f00000
RSP = 0000146304ab2248 RBP = 0000146304ab2250
RSI = 0000146304ab2350 RDI = 00000000110b6c80
R8 = 0000000000000000 R9 = 0000000000000000
R10 = 0000000000000000 R11 = 0000000000000001
R12 = 00001465d508f260 R13 = 0000146304ab2350
R14 = 0000146304ab2270 R15 = 00001465b4460a40
RIP = 0000110969f00000 EFL = 0000000000010283
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x0000110969f00000 <unknown-module>+00000000
[ 1] 0x00001465d521c7a6 /usr/local/matlab/R2024a/bin/glnxa64/libmwfoundation_matlabdata.so+00792486 _ZNK10foundation10matlabdata5Array7getTypeEv+00000038
[ 2] 0x00001465d4f8c0ce /usr/local/matlab/R2024a/bin/glnxa64/libmwsettingscore.so+02400462
[ 3] 0x00001465d4f1c244 /usr/local/matlab/R2024a/bin/glnxa64/libmwsettingscore.so+01942084 _ZNK8settings4core8Settings3getIbEEN7mwboost16remove_referenceIT_E4typeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESF_+00000052
[ 4] 0x00001465681cfbfd /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpproxy/matlab/httpproxy/libmwmatlabhttpproxy.so+00035837
[ 5] 0x00001465b20b2820 /usr/local/matlab/R2024a/bin/glnxa64/matlab_startup_plugins/cefclient/../../../../bin/glnxa64/libmwflhttpproxy.so+00043040
[ 6] 0x00001465681d2756 /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpproxy/matlab/httpproxy/libmwmatlabhttpproxy.so+00046934
[ 7] 0x00001465683c6e29 /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpclient/foundation/httpclient_core/implementation/mwhttpclient_core_implementation.so+01121833
[ 8] 0x00001465683ce3cc /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpclient/foundation/httpclient_core/implementation/mwhttpclient_core_implementation.so+01151948
[ 9] 0x00001465cd17102d /usr/local/matlab/R2024a/bin/glnxa64/factory_settings/project/settings/../../../../../bin/glnxa64/libmwflhttpclient_core.so+00135213 _ZNK10foundation15httpclient_core10HttpClient11makeRequestENS0_11HttpRequestE+00000189
[ 10] 0x00001465b1bd63ed /usr/local/matlab/R2024a/bin/glnxa64/matlab_startup_plugins/jmi/../../../../bin/glnxa64/libmwxmlutils.so+00091117 _ZN2mw8xmlutils12LibXML2Utils22readDOMDocumentFromUrlERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+00002173
[ 11] 0x000014656930f8f3 /usr/local/matlab/R2024a/bin/glnxa64/registration_framework_plugins/addons/core_reg_point_api_impl/../../../../../bin/glnxa64/libmwaddons_registry_core.so+00780531 _ZN6addons8registry17MetadataFileUtils38getPreviewImageUrlUsingMetadataFileUrlERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+00000147
[ 12] 0x000014630126d80f /usr/local/matlab/R2024a/bin/glnxa64/libaddons_registry_jni.so+00018447 Java_com_mathworks_addons_1registry_MetadataFileUtils_1Jni_getPreviewImageUrlUsingURL_1Native+00000095
[ 13] 0x00001464f50186c7 <unknown-module>+00000000
[ 14] 0x00001464f5008040 <unknown-module>+00000000
[ 15] 0x00001464f5008040 <unknown-module>+00000000
[ 16] 0x00001464f5008040 <unknown-module>+00000000
[ 17] 0x00001464f5008040 <unknown-module>+00000000
[ 18] 0x00001464f5008040 <unknown-module>+00000000
[ 19] 0x00001464f5c59e4c <unknown-module>+00000000
[ 20] 0x00001464f50082bd <unknown-module>+00000000
[ 21] 0x00001464f5008302 <unknown-module>+00000000
[ 22] 0x00001464f50007a7 <unknown-module>+00000000
[ 23] 0x000014656ac9b39b /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06849435
[ 24] 0x000014656ac98c63 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06839395
[ 25] 0x000014656ac99227 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06840871
[ 26] 0x000014656ad0539c /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07283612
[ 27] 0x000014656b08e9eb /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992107
[ 28] 0x000014656b08ecf1 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992881
[ 29] 0x000014656af208c2 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09492674
[ 30] 0x00001465d69731ca /lib64/libpthread.so.0+00033226
[ 31] 0x00001465d63dc8d3 /lib64/libc.so.6+00235731 clone+00000067 Since upgrading from Matlab R2021a to R2024a, I am consistently seeing deadlocks and segmentation faults when starting matlab in -batch mode
OS: Rocky Linux 8 (or 9)
Other command line arguments – matlab -nosplash -nodesktop -noFigureWindows -timing -sd /home/simuser -logfile /home/simuser/jobRunner.log -batch "disp(‘hello-world’);pause(10);disp(‘hello-world’);"
Fault Count: 1
Abnormal termination:
Segmentation violation
Current Thread: ‘ED 0 dispatch t’ id 22415512651520
Register State (from fault):
RAX = 000000001100fe46 RBX = 0000146304ab2290
RCX = 00001465d51eb6e0 RDX = 0000110969f00000
RSP = 0000146304ab2248 RBP = 0000146304ab2250
RSI = 0000146304ab2350 RDI = 00000000110b6c80
R8 = 0000000000000000 R9 = 0000000000000000
R10 = 0000000000000000 R11 = 0000000000000001
R12 = 00001465d508f260 R13 = 0000146304ab2350
R14 = 0000146304ab2270 R15 = 00001465b4460a40
RIP = 0000110969f00000 EFL = 0000000000010283
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x0000110969f00000 <unknown-module>+00000000
[ 1] 0x00001465d521c7a6 /usr/local/matlab/R2024a/bin/glnxa64/libmwfoundation_matlabdata.so+00792486 _ZNK10foundation10matlabdata5Array7getTypeEv+00000038
[ 2] 0x00001465d4f8c0ce /usr/local/matlab/R2024a/bin/glnxa64/libmwsettingscore.so+02400462
[ 3] 0x00001465d4f1c244 /usr/local/matlab/R2024a/bin/glnxa64/libmwsettingscore.so+01942084 _ZNK8settings4core8Settings3getIbEEN7mwboost16remove_referenceIT_E4typeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESF_+00000052
[ 4] 0x00001465681cfbfd /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpproxy/matlab/httpproxy/libmwmatlabhttpproxy.so+00035837
[ 5] 0x00001465b20b2820 /usr/local/matlab/R2024a/bin/glnxa64/matlab_startup_plugins/cefclient/../../../../bin/glnxa64/libmwflhttpproxy.so+00043040
[ 6] 0x00001465681d2756 /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpproxy/matlab/httpproxy/libmwmatlabhttpproxy.so+00046934
[ 7] 0x00001465683c6e29 /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpclient/foundation/httpclient_core/implementation/mwhttpclient_core_implementation.so+01121833
[ 8] 0x00001465683ce3cc /usr/local/matlab/R2024a/bin/glnxa64/foundation/httpclient/foundation/httpclient_core/implementation/mwhttpclient_core_implementation.so+01151948
[ 9] 0x00001465cd17102d /usr/local/matlab/R2024a/bin/glnxa64/factory_settings/project/settings/../../../../../bin/glnxa64/libmwflhttpclient_core.so+00135213 _ZNK10foundation15httpclient_core10HttpClient11makeRequestENS0_11HttpRequestE+00000189
[ 10] 0x00001465b1bd63ed /usr/local/matlab/R2024a/bin/glnxa64/matlab_startup_plugins/jmi/../../../../bin/glnxa64/libmwxmlutils.so+00091117 _ZN2mw8xmlutils12LibXML2Utils22readDOMDocumentFromUrlERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+00002173
[ 11] 0x000014656930f8f3 /usr/local/matlab/R2024a/bin/glnxa64/registration_framework_plugins/addons/core_reg_point_api_impl/../../../../../bin/glnxa64/libmwaddons_registry_core.so+00780531 _ZN6addons8registry17MetadataFileUtils38getPreviewImageUrlUsingMetadataFileUrlERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+00000147
[ 12] 0x000014630126d80f /usr/local/matlab/R2024a/bin/glnxa64/libaddons_registry_jni.so+00018447 Java_com_mathworks_addons_1registry_MetadataFileUtils_1Jni_getPreviewImageUrlUsingURL_1Native+00000095
[ 13] 0x00001464f50186c7 <unknown-module>+00000000
[ 14] 0x00001464f5008040 <unknown-module>+00000000
[ 15] 0x00001464f5008040 <unknown-module>+00000000
[ 16] 0x00001464f5008040 <unknown-module>+00000000
[ 17] 0x00001464f5008040 <unknown-module>+00000000
[ 18] 0x00001464f5008040 <unknown-module>+00000000
[ 19] 0x00001464f5c59e4c <unknown-module>+00000000
[ 20] 0x00001464f50082bd <unknown-module>+00000000
[ 21] 0x00001464f5008302 <unknown-module>+00000000
[ 22] 0x00001464f50007a7 <unknown-module>+00000000
[ 23] 0x000014656ac9b39b /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06849435
[ 24] 0x000014656ac98c63 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06839395
[ 25] 0x000014656ac99227 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+06840871
[ 26] 0x000014656ad0539c /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+07283612
[ 27] 0x000014656b08e9eb /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992107
[ 28] 0x000014656b08ecf1 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+10992881
[ 29] 0x000014656af208c2 /usr/local/matlab/R2024a/sys/java/jre/glnxa64/jre/lib/amd64/server/libjvm.so+09492674
[ 30] 0x00001465d69731ca /lib64/libpthread.so.0+00033226
[ 31] 0x00001465d63dc8d3 /lib64/libc.so.6+00235731 clone+00000067 linux, segmentation fault, startup MATLAB Answers — New Questions
Generating I and Q modulation data
Hi everyone,
I am developing a transmitter and would like to test the same with the help of modulated waveforms. I am considering developing a simple OTFS modulated waveform, and from this generate a text files with I and Q data that can be used with keysight ADS and measuring equipment.
Could someone give me a basic overview of how this can be done?
Thank You!!Hi everyone,
I am developing a transmitter and would like to test the same with the help of modulated waveforms. I am considering developing a simple OTFS modulated waveform, and from this generate a text files with I and Q data that can be used with keysight ADS and measuring equipment.
Could someone give me a basic overview of how this can be done?
Thank You!! Hi everyone,
I am developing a transmitter and would like to test the same with the help of modulated waveforms. I am considering developing a simple OTFS modulated waveform, and from this generate a text files with I and Q data that can be used with keysight ADS and measuring equipment.
Could someone give me a basic overview of how this can be done?
Thank You!! matlab MATLAB Answers — New Questions
After changing the Java Virtual Machine (JVM) that MATLAB is using on Windows can I delete/remove the C:Program FilesMATLABR2024ajava folder
I want to change which JVM that MATLAB is using on Windows.
After changing the Java Virtual Machine (JVM) that MATLAB is using on Windows can I delete/remove the
C:Program FilesMATLABR2024ajava folderI want to change which JVM that MATLAB is using on Windows.
After changing the Java Virtual Machine (JVM) that MATLAB is using on Windows can I delete/remove the
C:Program FilesMATLABR2024ajava folder I want to change which JVM that MATLAB is using on Windows.
After changing the Java Virtual Machine (JVM) that MATLAB is using on Windows can I delete/remove the
C:Program FilesMATLABR2024ajava folder can i delete the java folder after changing jvm MATLAB Answers — New Questions
how to delete ble object in app designer
I built an UI in App designer to read data from a Arduino BLE (bluetooth low energy) device
problem is I couldn’t use ‘clear’ or ‘delete’ functions to disconnect from the device, ‘clear’ doesn’t do anything and ‘delete’ pops an error saying that ble object cannot access the delete function, so far the only way that works is to close the app
is there any other way to do this in codes??I built an UI in App designer to read data from a Arduino BLE (bluetooth low energy) device
problem is I couldn’t use ‘clear’ or ‘delete’ functions to disconnect from the device, ‘clear’ doesn’t do anything and ‘delete’ pops an error saying that ble object cannot access the delete function, so far the only way that works is to close the app
is there any other way to do this in codes?? I built an UI in App designer to read data from a Arduino BLE (bluetooth low energy) device
problem is I couldn’t use ‘clear’ or ‘delete’ functions to disconnect from the device, ‘clear’ doesn’t do anything and ‘delete’ pops an error saying that ble object cannot access the delete function, so far the only way that works is to close the app
is there any other way to do this in codes?? ble communication, app designer MATLAB Answers — New Questions
How to hide row in excel from Matlab
I would like to hide an entire row in excel from Matlab. I know there is a way to delete a row with activex, but is there a way to hide the row instead?I would like to hide an entire row in excel from Matlab. I know there is a way to delete a row with activex, but is there a way to hide the row instead? I would like to hide an entire row in excel from Matlab. I know there is a way to delete a row with activex, but is there a way to hide the row instead? excel, activex, hide rows MATLAB Answers — New Questions
Spatial plot land part in gray color
I am plotting a spatial plot, I want land parts should be in gray or white colour. The code I am attaching is not working
figure;
imagesc(lon, lat, corr_coeff_weak’);
set(gca, ‘YDir’, ‘normal’);
colorbar;
colormap(redblue);
caxis([-1 1]);
xlabel(‘Longitude’);
ylabel(‘Latitude’);
title(‘Correlation for Weak SST Years’);
hold on;
load coastlines;
fill(wrapTo360(coastlon), coastlat, ‘w’, ‘EdgeColor’, ‘none’); % Fill land with white
plot(wrapTo360(coastlon), coastlat, ‘k.’, ‘MarkerSize’, 4);
axis xy;I am plotting a spatial plot, I want land parts should be in gray or white colour. The code I am attaching is not working
figure;
imagesc(lon, lat, corr_coeff_weak’);
set(gca, ‘YDir’, ‘normal’);
colorbar;
colormap(redblue);
caxis([-1 1]);
xlabel(‘Longitude’);
ylabel(‘Latitude’);
title(‘Correlation for Weak SST Years’);
hold on;
load coastlines;
fill(wrapTo360(coastlon), coastlat, ‘w’, ‘EdgeColor’, ‘none’); % Fill land with white
plot(wrapTo360(coastlon), coastlat, ‘k.’, ‘MarkerSize’, 4);
axis xy; I am plotting a spatial plot, I want land parts should be in gray or white colour. The code I am attaching is not working
figure;
imagesc(lon, lat, corr_coeff_weak’);
set(gca, ‘YDir’, ‘normal’);
colorbar;
colormap(redblue);
caxis([-1 1]);
xlabel(‘Longitude’);
ylabel(‘Latitude’);
title(‘Correlation for Weak SST Years’);
hold on;
load coastlines;
fill(wrapTo360(coastlon), coastlat, ‘w’, ‘EdgeColor’, ‘none’); % Fill land with white
plot(wrapTo360(coastlon), coastlat, ‘k.’, ‘MarkerSize’, 4);
axis xy; matrix, matrix manipulation, spatial maps, coastal boundary, image processing MATLAB Answers — New Questions
Open txt file with UI control and pass to Class
Good eve everybody,
Im trying to create an app to visualize data from a huge array. This array is stored in a CWF file but I can open it in notepad and read it easily so I gues I should be able to open it with a press on a button and start the OpenDialog select the file and pass the data to a class so I can extract all the data I need. Well it look easy but for some kind of reason I make a mistake and maybe someone can point out what I do wrong.
% So this code opens the dialog and I’m able to select the file I need. I
% expect that the file will be imported into A. Load data is a class where
% I want to exract everything.
function LoadChannel1ButtonPushed(app, event)
[file,path] = uigetfile(‘*.cwf’);
if isequal(file,0)
disp(‘User selected Cancel’);
else
A = importdata(file, ‘ ‘)
app.LoadData(A);
end
end
Unfortunately I get the error message ‘unable to open file’ , I have tried also the path together with the file but no luck. But when I code the load function with the path including the filename all goes well.
I think I make a mistake with file but I don;t see what.
Thanks for the help in advanceGood eve everybody,
Im trying to create an app to visualize data from a huge array. This array is stored in a CWF file but I can open it in notepad and read it easily so I gues I should be able to open it with a press on a button and start the OpenDialog select the file and pass the data to a class so I can extract all the data I need. Well it look easy but for some kind of reason I make a mistake and maybe someone can point out what I do wrong.
% So this code opens the dialog and I’m able to select the file I need. I
% expect that the file will be imported into A. Load data is a class where
% I want to exract everything.
function LoadChannel1ButtonPushed(app, event)
[file,path] = uigetfile(‘*.cwf’);
if isequal(file,0)
disp(‘User selected Cancel’);
else
A = importdata(file, ‘ ‘)
app.LoadData(A);
end
end
Unfortunately I get the error message ‘unable to open file’ , I have tried also the path together with the file but no luck. But when I code the load function with the path including the filename all goes well.
I think I make a mistake with file but I don;t see what.
Thanks for the help in advance Good eve everybody,
Im trying to create an app to visualize data from a huge array. This array is stored in a CWF file but I can open it in notepad and read it easily so I gues I should be able to open it with a press on a button and start the OpenDialog select the file and pass the data to a class so I can extract all the data I need. Well it look easy but for some kind of reason I make a mistake and maybe someone can point out what I do wrong.
% So this code opens the dialog and I’m able to select the file I need. I
% expect that the file will be imported into A. Load data is a class where
% I want to exract everything.
function LoadChannel1ButtonPushed(app, event)
[file,path] = uigetfile(‘*.cwf’);
if isequal(file,0)
disp(‘User selected Cancel’);
else
A = importdata(file, ‘ ‘)
app.LoadData(A);
end
end
Unfortunately I get the error message ‘unable to open file’ , I have tried also the path together with the file but no luck. But when I code the load function with the path including the filename all goes well.
I think I make a mistake with file but I don;t see what.
Thanks for the help in advance uiopen, matla MATLAB Answers — New Questions
How to use error handling with tcpclient in R2021b?
I am using tcpclient to communicate with a remote server, and when data is received I want to process that data using a callback. However, if any error occurs in the callback, that error is not reported to the command line. Here’s a minimum working example:
echotcpip(‘on’,7841); %Just a random port
obj = tcpclient(‘localhost’,7841);
obj.configureTerminator(‘CR/LF’);
obj.configureCallback(‘terminator’,@(~,~) error(‘An error!’));
obj.writeline(‘Hello’);
When data is received, I expect an error to be thrown, but instead nothing happens. If I replace the callback with something that doesn’t throw an error:
obj.configureCallback(‘terminator’,@(~,~) disp(‘No errors here’));
obj.writeline(‘Hello’);
the line "No errors here" is printed on the command line, as expected.
How do I get the errors in the callback to show up? The ErrorOccurredFcn appears to only apply to internal errors in the tcpclient class, and not to errors in the callback function.
This is a problem in R2021b, but not in R2022a (and probably in later versions), but if there is a solution that does not involve upgrading to the next release, that would be great. I’ve had severe performance issues with tcpclient when switching versions, and I’d like to avoid the risk of dealing with that if it isn’t necessary.I am using tcpclient to communicate with a remote server, and when data is received I want to process that data using a callback. However, if any error occurs in the callback, that error is not reported to the command line. Here’s a minimum working example:
echotcpip(‘on’,7841); %Just a random port
obj = tcpclient(‘localhost’,7841);
obj.configureTerminator(‘CR/LF’);
obj.configureCallback(‘terminator’,@(~,~) error(‘An error!’));
obj.writeline(‘Hello’);
When data is received, I expect an error to be thrown, but instead nothing happens. If I replace the callback with something that doesn’t throw an error:
obj.configureCallback(‘terminator’,@(~,~) disp(‘No errors here’));
obj.writeline(‘Hello’);
the line "No errors here" is printed on the command line, as expected.
How do I get the errors in the callback to show up? The ErrorOccurredFcn appears to only apply to internal errors in the tcpclient class, and not to errors in the callback function.
This is a problem in R2021b, but not in R2022a (and probably in later versions), but if there is a solution that does not involve upgrading to the next release, that would be great. I’ve had severe performance issues with tcpclient when switching versions, and I’d like to avoid the risk of dealing with that if it isn’t necessary. I am using tcpclient to communicate with a remote server, and when data is received I want to process that data using a callback. However, if any error occurs in the callback, that error is not reported to the command line. Here’s a minimum working example:
echotcpip(‘on’,7841); %Just a random port
obj = tcpclient(‘localhost’,7841);
obj.configureTerminator(‘CR/LF’);
obj.configureCallback(‘terminator’,@(~,~) error(‘An error!’));
obj.writeline(‘Hello’);
When data is received, I expect an error to be thrown, but instead nothing happens. If I replace the callback with something that doesn’t throw an error:
obj.configureCallback(‘terminator’,@(~,~) disp(‘No errors here’));
obj.writeline(‘Hello’);
the line "No errors here" is printed on the command line, as expected.
How do I get the errors in the callback to show up? The ErrorOccurredFcn appears to only apply to internal errors in the tcpclient class, and not to errors in the callback function.
This is a problem in R2021b, but not in R2022a (and probably in later versions), but if there is a solution that does not involve upgrading to the next release, that would be great. I’ve had severe performance issues with tcpclient when switching versions, and I’d like to avoid the risk of dealing with that if it isn’t necessary. tcpclient, error MATLAB Answers — New Questions
Contains in cells extracted from a structure runs into char class problems
Hi everyone,
Gonna try to be brief. Basically I have a structure with a certain number of columns, and I need to know if a certain element already exists in the column, as to retrieve its index and then check other columns on the same row.
So if indications is the struct, and curr_ID is what I am trying to look for I coded something like this:
if secondPass && contains({indications.Patient_ID}, curr_ID)
idx = find(contains({indications.Patient_ID}, curr_ID),1, ‘first’);
end
(…)
Now the problem is that contains is outputing and error saying that "First argument must be text". Has anybody encountered this?
To be clear, contains works with cells, and if you do A = {indications.Patient_ID} you will see that A is a cell populated with the text from all the columns of Patient_ID. I also use contains with a different cell (ZZ for example) that originates from a function and there it works fine. I don’t know if anybody has noticed but when using A={struct.field} what I actually get when looking using the variable viewer is a something that looks like this:
‘ID111’
‘ID112’
‘ID113’
…
However, for my other cells of chars when looking using the varaible viewer I do not see the ‘ around the words. I wonder if this is a problem even though both class(A{1,1}) and class(ZZ{1,1}) both come out as char.
Thanks in advance for the help!Hi everyone,
Gonna try to be brief. Basically I have a structure with a certain number of columns, and I need to know if a certain element already exists in the column, as to retrieve its index and then check other columns on the same row.
So if indications is the struct, and curr_ID is what I am trying to look for I coded something like this:
if secondPass && contains({indications.Patient_ID}, curr_ID)
idx = find(contains({indications.Patient_ID}, curr_ID),1, ‘first’);
end
(…)
Now the problem is that contains is outputing and error saying that "First argument must be text". Has anybody encountered this?
To be clear, contains works with cells, and if you do A = {indications.Patient_ID} you will see that A is a cell populated with the text from all the columns of Patient_ID. I also use contains with a different cell (ZZ for example) that originates from a function and there it works fine. I don’t know if anybody has noticed but when using A={struct.field} what I actually get when looking using the variable viewer is a something that looks like this:
‘ID111’
‘ID112’
‘ID113’
…
However, for my other cells of chars when looking using the varaible viewer I do not see the ‘ around the words. I wonder if this is a problem even though both class(A{1,1}) and class(ZZ{1,1}) both come out as char.
Thanks in advance for the help! Hi everyone,
Gonna try to be brief. Basically I have a structure with a certain number of columns, and I need to know if a certain element already exists in the column, as to retrieve its index and then check other columns on the same row.
So if indications is the struct, and curr_ID is what I am trying to look for I coded something like this:
if secondPass && contains({indications.Patient_ID}, curr_ID)
idx = find(contains({indications.Patient_ID}, curr_ID),1, ‘first’);
end
(…)
Now the problem is that contains is outputing and error saying that "First argument must be text". Has anybody encountered this?
To be clear, contains works with cells, and if you do A = {indications.Patient_ID} you will see that A is a cell populated with the text from all the columns of Patient_ID. I also use contains with a different cell (ZZ for example) that originates from a function and there it works fine. I don’t know if anybody has noticed but when using A={struct.field} what I actually get when looking using the variable viewer is a something that looks like this:
‘ID111’
‘ID112’
‘ID113’
…
However, for my other cells of chars when looking using the varaible viewer I do not see the ‘ around the words. I wonder if this is a problem even though both class(A{1,1}) and class(ZZ{1,1}) both come out as char.
Thanks in advance for the help! programming MATLAB Answers — New Questions
Creating Single-Use Password for .exe app Created in MATLAB
Is there a way to create password for only one user/installation for .exe apps created in MATLAB.
I want to create a password for single user/installation so that other people don’t get to copy the app and use.
Is there a way for this?
Thanks in advance.Is there a way to create password for only one user/installation for .exe apps created in MATLAB.
I want to create a password for single user/installation so that other people don’t get to copy the app and use.
Is there a way for this?
Thanks in advance. Is there a way to create password for only one user/installation for .exe apps created in MATLAB.
I want to create a password for single user/installation so that other people don’t get to copy the app and use.
Is there a way for this?
Thanks in advance. setting password, single installation MATLAB Answers — New Questions
Error Using OptimizationObjects.ProjectionBasedOptimizer/projection (line 6) – Memory Error
The Situation:
When trimming and linearizing a large Simulink model, we are consistantly running into memory problems with MATLAB that is causing it to crash.
Couple of notes:
It is a large simulink model with a lot of unit delay, delay, rate transition blocks
I have already went through the entire simulink sim and removed all data logging but I am still getting an error about "Data logging exceeded available memory" and "Cannot allocate sufficient memory for logging. Consider disabling logging or reducing the length of the simulation"
We are using two optimization algorithms with fmincon, 1. interior-point and 2. SQP, and trying multiple attempts to trim the model for one flight condition
We have a few sfunctions within the simulink model, two are large, the addition of one of the two large models to the simulink model that is being trimmed and linearized has made this issue worse
We are using fastRestartForLinearAnalysis
Reference the picture below for the error that I was able to catch
Now the questions:
Is there something with fastRestartForLinearAnalysis that is causing memory to be used up that we cannot see? (using the task manager on the pc, it doesnt appear that the full memory is being used/allocated)
Could this be caused by our choice of optimization algorithm? I have already read the "Choose the Algorithm" page which suggests that using SQP with this large scale optimization could cause issues
What else could it be?The Situation:
When trimming and linearizing a large Simulink model, we are consistantly running into memory problems with MATLAB that is causing it to crash.
Couple of notes:
It is a large simulink model with a lot of unit delay, delay, rate transition blocks
I have already went through the entire simulink sim and removed all data logging but I am still getting an error about "Data logging exceeded available memory" and "Cannot allocate sufficient memory for logging. Consider disabling logging or reducing the length of the simulation"
We are using two optimization algorithms with fmincon, 1. interior-point and 2. SQP, and trying multiple attempts to trim the model for one flight condition
We have a few sfunctions within the simulink model, two are large, the addition of one of the two large models to the simulink model that is being trimmed and linearized has made this issue worse
We are using fastRestartForLinearAnalysis
Reference the picture below for the error that I was able to catch
Now the questions:
Is there something with fastRestartForLinearAnalysis that is causing memory to be used up that we cannot see? (using the task manager on the pc, it doesnt appear that the full memory is being used/allocated)
Could this be caused by our choice of optimization algorithm? I have already read the "Choose the Algorithm" page which suggests that using SQP with this large scale optimization could cause issues
What else could it be? The Situation:
When trimming and linearizing a large Simulink model, we are consistantly running into memory problems with MATLAB that is causing it to crash.
Couple of notes:
It is a large simulink model with a lot of unit delay, delay, rate transition blocks
I have already went through the entire simulink sim and removed all data logging but I am still getting an error about "Data logging exceeded available memory" and "Cannot allocate sufficient memory for logging. Consider disabling logging or reducing the length of the simulation"
We are using two optimization algorithms with fmincon, 1. interior-point and 2. SQP, and trying multiple attempts to trim the model for one flight condition
We have a few sfunctions within the simulink model, two are large, the addition of one of the two large models to the simulink model that is being trimmed and linearized has made this issue worse
We are using fastRestartForLinearAnalysis
Reference the picture below for the error that I was able to catch
Now the questions:
Is there something with fastRestartForLinearAnalysis that is causing memory to be used up that we cannot see? (using the task manager on the pc, it doesnt appear that the full memory is being used/allocated)
Could this be caused by our choice of optimization algorithm? I have already read the "Choose the Algorithm" page which suggests that using SQP with this large scale optimization could cause issues
What else could it be? optimization, linearization MATLAB Answers — New Questions