Category: Matlab
Category Archives: Matlab
How can I simulate a pv/wind/battery hybrid microgrid for a rural area in kapiri with errors?
Those are my values for the area I’ve chosen and simulated block diagrams that I tried to simulate but the waveforms are not being produced. Please help me spot the mistakes I made and help with simulations that would with my area specifications.Those are my values for the area I’ve chosen and simulated block diagrams that I tried to simulate but the waveforms are not being produced. Please help me spot the mistakes I made and help with simulations that would with my area specifications. Those are my values for the area I’ve chosen and simulated block diagrams that I tried to simulate but the waveforms are not being produced. Please help me spot the mistakes I made and help with simulations that would with my area specifications. final year project MATLAB Answers — New Questions
How do I dock figures next to the editor by default ?
set(0,’DefaultFigureWindowStyle’,’docked’) does not work. It still opens the figure in a new windows an I have to right click and click on "Dock figures". Alternatively I can press CTRL+Shift+D but I dont want to do that. Typing get(0,’DefaultFigureWindowStyle’) gives me "docked" as an answer so the command is working appearently.
How can I make it so the figure appears next to the editor by default without me pressing CTRL+Shift+D everytime ?set(0,’DefaultFigureWindowStyle’,’docked’) does not work. It still opens the figure in a new windows an I have to right click and click on "Dock figures". Alternatively I can press CTRL+Shift+D but I dont want to do that. Typing get(0,’DefaultFigureWindowStyle’) gives me "docked" as an answer so the command is working appearently.
How can I make it so the figure appears next to the editor by default without me pressing CTRL+Shift+D everytime ? set(0,’DefaultFigureWindowStyle’,’docked’) does not work. It still opens the figure in a new windows an I have to right click and click on "Dock figures". Alternatively I can press CTRL+Shift+D but I dont want to do that. Typing get(0,’DefaultFigureWindowStyle’) gives me "docked" as an answer so the command is working appearently.
How can I make it so the figure appears next to the editor by default without me pressing CTRL+Shift+D everytime ? figure, graph, matlab, gui, default MATLAB Answers — New Questions
MATLAB and C++ Automatic coupling
Hi support,
I would like to develop an automatic coupling between C++ and MATLAB .
In simple Word:
* – Import in C++ the data from a .mat file
* – Run the simulation in C++
* – Export the results back in a .mat file
Based on the above details of my case, could you advise me for a way to start with?
Please let me know if you require any further clarifications.
Thank you for your continuous support.
Yahia Alabbasi B.C.Eng (Hons)
Research Assistant- Qatar University-Department of Civil and Architectural EngineeringHi support,
I would like to develop an automatic coupling between C++ and MATLAB .
In simple Word:
* – Import in C++ the data from a .mat file
* – Run the simulation in C++
* – Export the results back in a .mat file
Based on the above details of my case, could you advise me for a way to start with?
Please let me know if you require any further clarifications.
Thank you for your continuous support.
Yahia Alabbasi B.C.Eng (Hons)
Research Assistant- Qatar University-Department of Civil and Architectural Engineering Hi support,
I would like to develop an automatic coupling between C++ and MATLAB .
In simple Word:
* – Import in C++ the data from a .mat file
* – Run the simulation in C++
* – Export the results back in a .mat file
Based on the above details of my case, could you advise me for a way to start with?
Please let me know if you require any further clarifications.
Thank you for your continuous support.
Yahia Alabbasi B.C.Eng (Hons)
Research Assistant- Qatar University-Department of Civil and Architectural Engineering c++, matlab, data import, export MATLAB Answers — New Questions
Can’t use MATLAB on fedora 42
After about 1 minute matlab crashes every time with the following error:
Unable to communicate with required MathWorks services (error 5201).
I have tried reinstalling MathWorks services as suggested elsewhere, and it dind’t change anything.After about 1 minute matlab crashes every time with the following error:
Unable to communicate with required MathWorks services (error 5201).
I have tried reinstalling MathWorks services as suggested elsewhere, and it dind’t change anything. After about 1 minute matlab crashes every time with the following error:
Unable to communicate with required MathWorks services (error 5201).
I have tried reinstalling MathWorks services as suggested elsewhere, and it dind’t change anything. linux, fedora, mathwork services MATLAB Answers — New Questions
How to Resize images stored in matlab.io.datastore.ImageDatastore to [224 224 3]
Hello I’m new in using pretrained networks in MATLAB for Object Detection and I was following a guide in Youtube which uses YOLO for detection. In this guide, it also used the resnet50 pretrained network which has an input layer that expects images of size (224x224x3).
Below is the code:
trainData1 = Data;
%%% Create resnet50 pretrained network
netWidth = 16;
layers = [
imageInputLayer([224 224 3], ‘Name’, ‘input’)
convolution2dLayer(3, netWidth, ‘Padding’,’same’, ‘Name’, ‘convInp’)
batchNormalizationLayer(‘Name’, ‘BNInp’)
reluLayer(‘Name’, ‘reluInp’)
convolutionalUnit(netWidth, 1, ‘S1U1’)
additionLayer(2, ‘Name’, ‘add11’)
reluLayer(‘Name’, ‘relu11’)
convolutionalUnit(netWidth, 1, ‘S1U2’)
additionLayer(2, ‘Name’, ‘add12’)
reluLayer(‘Name’, ‘relu12’)
convolutionalUnit(2*netWidth, 2, ‘S2U1’)
additionLayer(2, ‘Name’, ‘add21’)
reluLayer(‘Name’, ‘relu21’)
convolutionalUnit(2*netWidth , 1, ‘S2U2’)
additionLayer(2, ‘Name’, ‘add22’)
reluLayer(‘Name’, ‘relu22’)
convolutionalUnit(4*netWidth, 2, ‘S3U1’)
additionLayer(2, ‘Name’, ‘add31’)
reluLayer(‘Name’, ‘relu31’)
convolutionalUnit(4*netWidth, 1, ‘S3U2’)
additionLayer(2, ‘Name’, ‘add32’)
reluLayer(‘Name’, ‘relu32’)
averagePooling2dLayer(8, ‘Name’, ‘globalPool’)
fullyConnectedLayer(4, ‘Name’, ‘fcFinal’)
softmaxLayer(‘Name’, ‘softmax’)
classificationLayer(‘Name’, ‘classoutput’)
];
lgraph = layerGraph(layers);
lgraph = connectLayers(lgraph, ‘reluInp’, ‘add11/in2’);
lgraph = connectLayers(lgraph, ‘relu11’, ‘add12/in2’);
skip1 = [
convolution2dLayer(1,2*netWidth, ‘Stride’, 2, ‘Name’, ‘skipConv1’)
batchNormalizationLayer(‘Name’, ‘skipBN1’)];
lgraph = addLayers(lgraph, skip1);
lgraph = connectLayers(lgraph, ‘relu12’, ‘skipConv1’);
lgraph = connectLayers(lgraph, ‘skipBN1’, ‘add21/in2’);
lgraph = connectLayers(lgraph, ‘relu21’, ‘add22/in2’);
skip2 = [
convolution2dLayer(1, 4*netWidth, ‘Stride’,2, ‘Name’, ‘skipConv2’)
batchNormalizationLayer(‘Name’,’skipBN2′)];
lgraph = addLayers(lgraph, skip2);
lgraph = connectLayers(lgraph, ‘relu22’, ‘skipConv2’);
lgraph = connectLayers(lgraph, ‘skipBN2’, ‘add31/in2’);
%add last identity connection and plot the final layer graph
lgraph = connectLayers(lgraph, ‘relu31’, ‘add32/in2’);
%training options
options = trainingOptions("sgdm", …
‘MiniBatchSize’, 128, …
‘MaxEpochs’, 1, …
‘InitialLearnRate’,1e-4);
% network training
[trainedNet1, traininfo] = trainNetwork(trainData1, lgraph, options);
And the output error is this:
% network training
[trainedNet1, traininfo] = trainNetwork(trainData1, lgraph, options);
Error using trainNetwork
The training images are of size 3024×4032×3 but the input layer expects images of size 224×224×3.
My workspace is this:
Thank You. Hope You Can Help.Hello I’m new in using pretrained networks in MATLAB for Object Detection and I was following a guide in Youtube which uses YOLO for detection. In this guide, it also used the resnet50 pretrained network which has an input layer that expects images of size (224x224x3).
Below is the code:
trainData1 = Data;
%%% Create resnet50 pretrained network
netWidth = 16;
layers = [
imageInputLayer([224 224 3], ‘Name’, ‘input’)
convolution2dLayer(3, netWidth, ‘Padding’,’same’, ‘Name’, ‘convInp’)
batchNormalizationLayer(‘Name’, ‘BNInp’)
reluLayer(‘Name’, ‘reluInp’)
convolutionalUnit(netWidth, 1, ‘S1U1’)
additionLayer(2, ‘Name’, ‘add11’)
reluLayer(‘Name’, ‘relu11’)
convolutionalUnit(netWidth, 1, ‘S1U2’)
additionLayer(2, ‘Name’, ‘add12’)
reluLayer(‘Name’, ‘relu12’)
convolutionalUnit(2*netWidth, 2, ‘S2U1’)
additionLayer(2, ‘Name’, ‘add21’)
reluLayer(‘Name’, ‘relu21’)
convolutionalUnit(2*netWidth , 1, ‘S2U2’)
additionLayer(2, ‘Name’, ‘add22’)
reluLayer(‘Name’, ‘relu22’)
convolutionalUnit(4*netWidth, 2, ‘S3U1’)
additionLayer(2, ‘Name’, ‘add31’)
reluLayer(‘Name’, ‘relu31’)
convolutionalUnit(4*netWidth, 1, ‘S3U2’)
additionLayer(2, ‘Name’, ‘add32’)
reluLayer(‘Name’, ‘relu32’)
averagePooling2dLayer(8, ‘Name’, ‘globalPool’)
fullyConnectedLayer(4, ‘Name’, ‘fcFinal’)
softmaxLayer(‘Name’, ‘softmax’)
classificationLayer(‘Name’, ‘classoutput’)
];
lgraph = layerGraph(layers);
lgraph = connectLayers(lgraph, ‘reluInp’, ‘add11/in2’);
lgraph = connectLayers(lgraph, ‘relu11’, ‘add12/in2’);
skip1 = [
convolution2dLayer(1,2*netWidth, ‘Stride’, 2, ‘Name’, ‘skipConv1’)
batchNormalizationLayer(‘Name’, ‘skipBN1’)];
lgraph = addLayers(lgraph, skip1);
lgraph = connectLayers(lgraph, ‘relu12’, ‘skipConv1’);
lgraph = connectLayers(lgraph, ‘skipBN1’, ‘add21/in2’);
lgraph = connectLayers(lgraph, ‘relu21’, ‘add22/in2’);
skip2 = [
convolution2dLayer(1, 4*netWidth, ‘Stride’,2, ‘Name’, ‘skipConv2’)
batchNormalizationLayer(‘Name’,’skipBN2′)];
lgraph = addLayers(lgraph, skip2);
lgraph = connectLayers(lgraph, ‘relu22’, ‘skipConv2’);
lgraph = connectLayers(lgraph, ‘skipBN2’, ‘add31/in2’);
%add last identity connection and plot the final layer graph
lgraph = connectLayers(lgraph, ‘relu31’, ‘add32/in2’);
%training options
options = trainingOptions("sgdm", …
‘MiniBatchSize’, 128, …
‘MaxEpochs’, 1, …
‘InitialLearnRate’,1e-4);
% network training
[trainedNet1, traininfo] = trainNetwork(trainData1, lgraph, options);
And the output error is this:
% network training
[trainedNet1, traininfo] = trainNetwork(trainData1, lgraph, options);
Error using trainNetwork
The training images are of size 3024×4032×3 but the input layer expects images of size 224×224×3.
My workspace is this:
Thank You. Hope You Can Help. Hello I’m new in using pretrained networks in MATLAB for Object Detection and I was following a guide in Youtube which uses YOLO for detection. In this guide, it also used the resnet50 pretrained network which has an input layer that expects images of size (224x224x3).
Below is the code:
trainData1 = Data;
%%% Create resnet50 pretrained network
netWidth = 16;
layers = [
imageInputLayer([224 224 3], ‘Name’, ‘input’)
convolution2dLayer(3, netWidth, ‘Padding’,’same’, ‘Name’, ‘convInp’)
batchNormalizationLayer(‘Name’, ‘BNInp’)
reluLayer(‘Name’, ‘reluInp’)
convolutionalUnit(netWidth, 1, ‘S1U1’)
additionLayer(2, ‘Name’, ‘add11’)
reluLayer(‘Name’, ‘relu11’)
convolutionalUnit(netWidth, 1, ‘S1U2’)
additionLayer(2, ‘Name’, ‘add12’)
reluLayer(‘Name’, ‘relu12’)
convolutionalUnit(2*netWidth, 2, ‘S2U1’)
additionLayer(2, ‘Name’, ‘add21’)
reluLayer(‘Name’, ‘relu21’)
convolutionalUnit(2*netWidth , 1, ‘S2U2’)
additionLayer(2, ‘Name’, ‘add22’)
reluLayer(‘Name’, ‘relu22’)
convolutionalUnit(4*netWidth, 2, ‘S3U1’)
additionLayer(2, ‘Name’, ‘add31’)
reluLayer(‘Name’, ‘relu31’)
convolutionalUnit(4*netWidth, 1, ‘S3U2’)
additionLayer(2, ‘Name’, ‘add32’)
reluLayer(‘Name’, ‘relu32’)
averagePooling2dLayer(8, ‘Name’, ‘globalPool’)
fullyConnectedLayer(4, ‘Name’, ‘fcFinal’)
softmaxLayer(‘Name’, ‘softmax’)
classificationLayer(‘Name’, ‘classoutput’)
];
lgraph = layerGraph(layers);
lgraph = connectLayers(lgraph, ‘reluInp’, ‘add11/in2’);
lgraph = connectLayers(lgraph, ‘relu11’, ‘add12/in2’);
skip1 = [
convolution2dLayer(1,2*netWidth, ‘Stride’, 2, ‘Name’, ‘skipConv1’)
batchNormalizationLayer(‘Name’, ‘skipBN1’)];
lgraph = addLayers(lgraph, skip1);
lgraph = connectLayers(lgraph, ‘relu12’, ‘skipConv1’);
lgraph = connectLayers(lgraph, ‘skipBN1’, ‘add21/in2’);
lgraph = connectLayers(lgraph, ‘relu21’, ‘add22/in2’);
skip2 = [
convolution2dLayer(1, 4*netWidth, ‘Stride’,2, ‘Name’, ‘skipConv2’)
batchNormalizationLayer(‘Name’,’skipBN2′)];
lgraph = addLayers(lgraph, skip2);
lgraph = connectLayers(lgraph, ‘relu22’, ‘skipConv2’);
lgraph = connectLayers(lgraph, ‘skipBN2’, ‘add31/in2’);
%add last identity connection and plot the final layer graph
lgraph = connectLayers(lgraph, ‘relu31’, ‘add32/in2’);
%training options
options = trainingOptions("sgdm", …
‘MiniBatchSize’, 128, …
‘MaxEpochs’, 1, …
‘InitialLearnRate’,1e-4);
% network training
[trainedNet1, traininfo] = trainNetwork(trainData1, lgraph, options);
And the output error is this:
% network training
[trainedNet1, traininfo] = trainNetwork(trainData1, lgraph, options);
Error using trainNetwork
The training images are of size 3024×4032×3 but the input layer expects images of size 224×224×3.
My workspace is this:
Thank You. Hope You Can Help. image processing, object detection, yolo, matlab, resizing, resnet50 MATLAB Answers — New Questions
How to present the content of a field in a program?
I want to present the variables and their value from a structure in a program, just for information for the users.
Let’s say:
a.a=234.5;
a.b=444;
a.s=’This is an example’;
a
if I run this code in the command window, I get the answer:
a =
struct with fields:
a: 234.5
b: 444
s: ‘This is an example’
I want to reproduce this answer and put it in a text window in my program. I could not figure out how to do that.
Thanks for any help!I want to present the variables and their value from a structure in a program, just for information for the users.
Let’s say:
a.a=234.5;
a.b=444;
a.s=’This is an example’;
a
if I run this code in the command window, I get the answer:
a =
struct with fields:
a: 234.5
b: 444
s: ‘This is an example’
I want to reproduce this answer and put it in a text window in my program. I could not figure out how to do that.
Thanks for any help! I want to present the variables and their value from a structure in a program, just for information for the users.
Let’s say:
a.a=234.5;
a.b=444;
a.s=’This is an example’;
a
if I run this code in the command window, I get the answer:
a =
struct with fields:
a: 234.5
b: 444
s: ‘This is an example’
I want to reproduce this answer and put it in a text window in my program. I could not figure out how to do that.
Thanks for any help! matlab, fields, structures MATLAB Answers — New Questions
I encountered the error ‘The MATLAB Editor requires Java.’
I encountered the error’The MATLAB Editor requires Java.’
while following the ‘Run Batch Parallel Jobs’ tutorial. I am seeking assistance with this issue.
+ Java’s version on my PC is
version -java
‘Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode’
And I have already installed the latest version of Java from Oracle.
The code I executed is shown below:
mywave.m
edit mywave
for i = 1:1024
A(i) = sin(i*2*pi/1024);
end
Untitled.m
job = batch(‘mywave’)
wait(job)
load(job)
Error message in Command window is shown below:
Error using parallel.Job/load (line 36)
Error encountered while running the batch job. The error was:
Error using edit (line 73)
The MATLAB Editor requires Java.
Error in mywave (line 1)
The same issue occurred in both (R2024a) and (R2023a).I encountered the error’The MATLAB Editor requires Java.’
while following the ‘Run Batch Parallel Jobs’ tutorial. I am seeking assistance with this issue.
+ Java’s version on my PC is
version -java
‘Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode’
And I have already installed the latest version of Java from Oracle.
The code I executed is shown below:
mywave.m
edit mywave
for i = 1:1024
A(i) = sin(i*2*pi/1024);
end
Untitled.m
job = batch(‘mywave’)
wait(job)
load(job)
Error message in Command window is shown below:
Error using parallel.Job/load (line 36)
Error encountered while running the batch job. The error was:
Error using edit (line 73)
The MATLAB Editor requires Java.
Error in mywave (line 1)
The same issue occurred in both (R2024a) and (R2023a). I encountered the error’The MATLAB Editor requires Java.’
while following the ‘Run Batch Parallel Jobs’ tutorial. I am seeking assistance with this issue.
+ Java’s version on my PC is
version -java
‘Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode’
And I have already installed the latest version of Java from Oracle.
The code I executed is shown below:
mywave.m
edit mywave
for i = 1:1024
A(i) = sin(i*2*pi/1024);
end
Untitled.m
job = batch(‘mywave’)
wait(job)
load(job)
Error message in Command window is shown below:
Error using parallel.Job/load (line 36)
Error encountered while running the batch job. The error was:
Error using edit (line 73)
The MATLAB Editor requires Java.
Error in mywave (line 1)
The same issue occurred in both (R2024a) and (R2023a). java MATLAB Answers — New Questions
How to do setup data queue handling between app designer and parallel thread?
Hello community
I want to use the Parallel Pool Box in App Designer to run a parallel thread and pass information between the two entitiies.
Imagine the following use case: You want to start, pause and abort i.e. a sequence of measurements from the GUI
In case the start is activated the start button changes to pause button and starts in parallel the measurement sequence.
In case the executions is paused, the current step of the sequence is allowed to be finished.
In case of abort the measurement shall be stopped immediatly and the instruments gracefully turned off.
I tried to represent this in a workflow (shown at end of post- file follows as soon as upload works again). And did setup a simplified .mlapp first trying to start a parallel thread queueing information and the main code fetching that information and diplaying it in a text area. But in that form I cannot save it as .mlapp file. From what I’ve read so far in the forum (see list below) it seems to be an issue of handing over the app object to the parallel process. But I don’t understand what I am doing wrong and thus think I missed an important part of the data queue handling. I would be glad for any hint/information/support to fix this issue and learn from that mistake.
Further information I checked prior to set up .mlapp:
https://ch.mathworks.com/matlabcentral/answers/867683-how-to-use-threads-in-matlab-app-designer/
https://ch.mathworks.com/matlabcentral/answers/1413247-threading-in-matlab-gui-callbacks
https://ch.mathworks.com/matlabcentral/answers/2164600-integrating-parallel-computing-with-app-designer-for-real-time-ui-updates
– https://www.mathworks.com/matlabcentral/answers/366576-will-there-be-a-support-of-the-parallel-toolbox-in-matlab-app-designer#comment_720548
https://ch.mathworks.com/help/parallel-computing/parallel.pool.dataqueue.html
https://ch.mathworks.com/help/parallel-computing/parpool.html
https://ch.mathworks.com/help/parallel-computing/parallel.pool.pollabledataqueue.html
https://ch.mathworks.com/help/parallel-computing/receive-communications-on-workers.html
https://in.mathworks.com/matlabcentral/answers/1726505-proper-use-of-dataqueue-and-pollabledataqueue-inside-of-app-designer-class
Example code which can not be saved as .mlapp
classdef ExampleWorkflowAbortAsyn < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
Abort2Button matlab.ui.control.StateButton
TextArea matlab.ui.control.TextArea
AbortButton matlab.ui.control.Button
StartButton matlab.ui.control.Button
end
properties (Access = public)
TCindex % Description
isPassed = false;
asycnWorker
dataQueue
clientQueue
helperClientQueue
end
methods (Static)
function receiveDataOnClient(data)
disp(data);
drawnow limitrate;
end
end
methods (Access = public)
function testExecutionMaster(app)
while strcmp(app.StartButton.Text, ‘Pause’)
app.isPassed = false;
updateUILog(app,sprintf(‘TC %i’, app.TCindex));
app.TCindex = app.TCindex + 1;
updateUILog(app,sprintf(‘tPrepare measurement…’));
pause(1)
updateUILog(app,sprintf(‘tExecute measurement…’));
pause(1)
updateUILog(app,sprintf(‘tAnalyze Measurement…’));
pause(1)
updateUILog(app,sprintf(‘t Test passed :)’));
app.isPassed = true;
end
end
function abortMeasurementAction(app)
% nice to have: pop up with abort error and instructions
updateUILog(app,’User triggerd abort starts’);
updateUILog(app,sprintf(‘tAll devices off’));
end
function updateUILog(app,message)
textArray = app.TextArea.Value;
textArray{end+1} = message;
app.TextArea.Value = textArray;
scroll(app.TextArea, ‘bottom’)
% createDiaryEntry(app, message)
end
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: StartButton
function EnterTestState(app, event)
switch app.StartButton.Text
case ‘Start’
app.StartButton.Text = ‘Pause’;
app.TCindex = 1;
asycnWorker = parpool(‘Threads’,1);
clientQueue = parallel.pool.DataQueue;
afterEach(clientQueue,@(data) app.receiveDataOnClient(data));
helperClientQueue = parallel.pool.PollableDataQueue;
temp = app.StartButton.Text;
wkrF = parallel.FevalFuture;
wkrF = parfeval(@testExecutionWorker,0,temp);
wkrQueue = poll(helperClientQueue,inf);
send(wkrQueue.Queue,"Start generating data");
case ‘Pause’
app.StartButton.Text = ‘Resume’;
updateUILog(app,’Test execution enters pause state’)
while ~app.isPassed
pause(0.2)
end
updateUILog(app,sprintf(‘Test execution paused at %i’, app.TCindex));
case ‘Resume’
app.StartButton.Text = ‘Pause’;
updateUILog(app,’Resume test execution’);
testExecutionMaster(app)
end
updateUILog(app,"End of EnterTestStateFunction")
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure(‘Visible’, ‘off’);
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = ‘MATLAB App’;
% Create StartButton
app.StartButton = uibutton(app.UIFigure, ‘push’);
app.StartButton.ButtonPushedFcn = createCallbackFcn(app, @EnterTestState, true);
app.StartButton.Position = [422 321 138 45];
app.StartButton.Text = ‘Start’;
% Create AbortButton
app.AbortButton = uibutton(app.UIFigure, ‘push’);
app.AbortButton.Position = [422 249 138 41];
app.AbortButton.Text = ‘Abort’;
% Create TextArea
app.TextArea = uitextarea(app.UIFigure);
app.TextArea.Editable = ‘off’;
app.TextArea.Position = [60 28 475 168];
% Create Abort2Button
app.Abort2Button = uibutton(app.UIFigure, ‘state’);
app.Abort2Button.Text = ‘Abort2’;
app.Abort2Button.Position = [129 289 186 54];
% Show the figure after all components are created
app.UIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = ExampleWorkflowAbortAsyn
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
endHello community
I want to use the Parallel Pool Box in App Designer to run a parallel thread and pass information between the two entitiies.
Imagine the following use case: You want to start, pause and abort i.e. a sequence of measurements from the GUI
In case the start is activated the start button changes to pause button and starts in parallel the measurement sequence.
In case the executions is paused, the current step of the sequence is allowed to be finished.
In case of abort the measurement shall be stopped immediatly and the instruments gracefully turned off.
I tried to represent this in a workflow (shown at end of post- file follows as soon as upload works again). And did setup a simplified .mlapp first trying to start a parallel thread queueing information and the main code fetching that information and diplaying it in a text area. But in that form I cannot save it as .mlapp file. From what I’ve read so far in the forum (see list below) it seems to be an issue of handing over the app object to the parallel process. But I don’t understand what I am doing wrong and thus think I missed an important part of the data queue handling. I would be glad for any hint/information/support to fix this issue and learn from that mistake.
Further information I checked prior to set up .mlapp:
https://ch.mathworks.com/matlabcentral/answers/867683-how-to-use-threads-in-matlab-app-designer/
https://ch.mathworks.com/matlabcentral/answers/1413247-threading-in-matlab-gui-callbacks
https://ch.mathworks.com/matlabcentral/answers/2164600-integrating-parallel-computing-with-app-designer-for-real-time-ui-updates
– https://www.mathworks.com/matlabcentral/answers/366576-will-there-be-a-support-of-the-parallel-toolbox-in-matlab-app-designer#comment_720548
https://ch.mathworks.com/help/parallel-computing/parallel.pool.dataqueue.html
https://ch.mathworks.com/help/parallel-computing/parpool.html
https://ch.mathworks.com/help/parallel-computing/parallel.pool.pollabledataqueue.html
https://ch.mathworks.com/help/parallel-computing/receive-communications-on-workers.html
https://in.mathworks.com/matlabcentral/answers/1726505-proper-use-of-dataqueue-and-pollabledataqueue-inside-of-app-designer-class
Example code which can not be saved as .mlapp
classdef ExampleWorkflowAbortAsyn < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
Abort2Button matlab.ui.control.StateButton
TextArea matlab.ui.control.TextArea
AbortButton matlab.ui.control.Button
StartButton matlab.ui.control.Button
end
properties (Access = public)
TCindex % Description
isPassed = false;
asycnWorker
dataQueue
clientQueue
helperClientQueue
end
methods (Static)
function receiveDataOnClient(data)
disp(data);
drawnow limitrate;
end
end
methods (Access = public)
function testExecutionMaster(app)
while strcmp(app.StartButton.Text, ‘Pause’)
app.isPassed = false;
updateUILog(app,sprintf(‘TC %i’, app.TCindex));
app.TCindex = app.TCindex + 1;
updateUILog(app,sprintf(‘tPrepare measurement…’));
pause(1)
updateUILog(app,sprintf(‘tExecute measurement…’));
pause(1)
updateUILog(app,sprintf(‘tAnalyze Measurement…’));
pause(1)
updateUILog(app,sprintf(‘t Test passed :)’));
app.isPassed = true;
end
end
function abortMeasurementAction(app)
% nice to have: pop up with abort error and instructions
updateUILog(app,’User triggerd abort starts’);
updateUILog(app,sprintf(‘tAll devices off’));
end
function updateUILog(app,message)
textArray = app.TextArea.Value;
textArray{end+1} = message;
app.TextArea.Value = textArray;
scroll(app.TextArea, ‘bottom’)
% createDiaryEntry(app, message)
end
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: StartButton
function EnterTestState(app, event)
switch app.StartButton.Text
case ‘Start’
app.StartButton.Text = ‘Pause’;
app.TCindex = 1;
asycnWorker = parpool(‘Threads’,1);
clientQueue = parallel.pool.DataQueue;
afterEach(clientQueue,@(data) app.receiveDataOnClient(data));
helperClientQueue = parallel.pool.PollableDataQueue;
temp = app.StartButton.Text;
wkrF = parallel.FevalFuture;
wkrF = parfeval(@testExecutionWorker,0,temp);
wkrQueue = poll(helperClientQueue,inf);
send(wkrQueue.Queue,"Start generating data");
case ‘Pause’
app.StartButton.Text = ‘Resume’;
updateUILog(app,’Test execution enters pause state’)
while ~app.isPassed
pause(0.2)
end
updateUILog(app,sprintf(‘Test execution paused at %i’, app.TCindex));
case ‘Resume’
app.StartButton.Text = ‘Pause’;
updateUILog(app,’Resume test execution’);
testExecutionMaster(app)
end
updateUILog(app,"End of EnterTestStateFunction")
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure(‘Visible’, ‘off’);
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = ‘MATLAB App’;
% Create StartButton
app.StartButton = uibutton(app.UIFigure, ‘push’);
app.StartButton.ButtonPushedFcn = createCallbackFcn(app, @EnterTestState, true);
app.StartButton.Position = [422 321 138 45];
app.StartButton.Text = ‘Start’;
% Create AbortButton
app.AbortButton = uibutton(app.UIFigure, ‘push’);
app.AbortButton.Position = [422 249 138 41];
app.AbortButton.Text = ‘Abort’;
% Create TextArea
app.TextArea = uitextarea(app.UIFigure);
app.TextArea.Editable = ‘off’;
app.TextArea.Position = [60 28 475 168];
% Create Abort2Button
app.Abort2Button = uibutton(app.UIFigure, ‘state’);
app.Abort2Button.Text = ‘Abort2’;
app.Abort2Button.Position = [129 289 186 54];
% Show the figure after all components are created
app.UIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = ExampleWorkflowAbortAsyn
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end Hello community
I want to use the Parallel Pool Box in App Designer to run a parallel thread and pass information between the two entitiies.
Imagine the following use case: You want to start, pause and abort i.e. a sequence of measurements from the GUI
In case the start is activated the start button changes to pause button and starts in parallel the measurement sequence.
In case the executions is paused, the current step of the sequence is allowed to be finished.
In case of abort the measurement shall be stopped immediatly and the instruments gracefully turned off.
I tried to represent this in a workflow (shown at end of post- file follows as soon as upload works again). And did setup a simplified .mlapp first trying to start a parallel thread queueing information and the main code fetching that information and diplaying it in a text area. But in that form I cannot save it as .mlapp file. From what I’ve read so far in the forum (see list below) it seems to be an issue of handing over the app object to the parallel process. But I don’t understand what I am doing wrong and thus think I missed an important part of the data queue handling. I would be glad for any hint/information/support to fix this issue and learn from that mistake.
Further information I checked prior to set up .mlapp:
https://ch.mathworks.com/matlabcentral/answers/867683-how-to-use-threads-in-matlab-app-designer/
https://ch.mathworks.com/matlabcentral/answers/1413247-threading-in-matlab-gui-callbacks
https://ch.mathworks.com/matlabcentral/answers/2164600-integrating-parallel-computing-with-app-designer-for-real-time-ui-updates
– https://www.mathworks.com/matlabcentral/answers/366576-will-there-be-a-support-of-the-parallel-toolbox-in-matlab-app-designer#comment_720548
https://ch.mathworks.com/help/parallel-computing/parallel.pool.dataqueue.html
https://ch.mathworks.com/help/parallel-computing/parpool.html
https://ch.mathworks.com/help/parallel-computing/parallel.pool.pollabledataqueue.html
https://ch.mathworks.com/help/parallel-computing/receive-communications-on-workers.html
https://in.mathworks.com/matlabcentral/answers/1726505-proper-use-of-dataqueue-and-pollabledataqueue-inside-of-app-designer-class
Example code which can not be saved as .mlapp
classdef ExampleWorkflowAbortAsyn < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
Abort2Button matlab.ui.control.StateButton
TextArea matlab.ui.control.TextArea
AbortButton matlab.ui.control.Button
StartButton matlab.ui.control.Button
end
properties (Access = public)
TCindex % Description
isPassed = false;
asycnWorker
dataQueue
clientQueue
helperClientQueue
end
methods (Static)
function receiveDataOnClient(data)
disp(data);
drawnow limitrate;
end
end
methods (Access = public)
function testExecutionMaster(app)
while strcmp(app.StartButton.Text, ‘Pause’)
app.isPassed = false;
updateUILog(app,sprintf(‘TC %i’, app.TCindex));
app.TCindex = app.TCindex + 1;
updateUILog(app,sprintf(‘tPrepare measurement…’));
pause(1)
updateUILog(app,sprintf(‘tExecute measurement…’));
pause(1)
updateUILog(app,sprintf(‘tAnalyze Measurement…’));
pause(1)
updateUILog(app,sprintf(‘t Test passed :)’));
app.isPassed = true;
end
end
function abortMeasurementAction(app)
% nice to have: pop up with abort error and instructions
updateUILog(app,’User triggerd abort starts’);
updateUILog(app,sprintf(‘tAll devices off’));
end
function updateUILog(app,message)
textArray = app.TextArea.Value;
textArray{end+1} = message;
app.TextArea.Value = textArray;
scroll(app.TextArea, ‘bottom’)
% createDiaryEntry(app, message)
end
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: StartButton
function EnterTestState(app, event)
switch app.StartButton.Text
case ‘Start’
app.StartButton.Text = ‘Pause’;
app.TCindex = 1;
asycnWorker = parpool(‘Threads’,1);
clientQueue = parallel.pool.DataQueue;
afterEach(clientQueue,@(data) app.receiveDataOnClient(data));
helperClientQueue = parallel.pool.PollableDataQueue;
temp = app.StartButton.Text;
wkrF = parallel.FevalFuture;
wkrF = parfeval(@testExecutionWorker,0,temp);
wkrQueue = poll(helperClientQueue,inf);
send(wkrQueue.Queue,"Start generating data");
case ‘Pause’
app.StartButton.Text = ‘Resume’;
updateUILog(app,’Test execution enters pause state’)
while ~app.isPassed
pause(0.2)
end
updateUILog(app,sprintf(‘Test execution paused at %i’, app.TCindex));
case ‘Resume’
app.StartButton.Text = ‘Pause’;
updateUILog(app,’Resume test execution’);
testExecutionMaster(app)
end
updateUILog(app,"End of EnterTestStateFunction")
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure(‘Visible’, ‘off’);
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = ‘MATLAB App’;
% Create StartButton
app.StartButton = uibutton(app.UIFigure, ‘push’);
app.StartButton.ButtonPushedFcn = createCallbackFcn(app, @EnterTestState, true);
app.StartButton.Position = [422 321 138 45];
app.StartButton.Text = ‘Start’;
% Create AbortButton
app.AbortButton = uibutton(app.UIFigure, ‘push’);
app.AbortButton.Position = [422 249 138 41];
app.AbortButton.Text = ‘Abort’;
% Create TextArea
app.TextArea = uitextarea(app.UIFigure);
app.TextArea.Editable = ‘off’;
app.TextArea.Position = [60 28 475 168];
% Create Abort2Button
app.Abort2Button = uibutton(app.UIFigure, ‘state’);
app.Abort2Button.Text = ‘Abort2’;
app.Abort2Button.Position = [129 289 186 54];
% Show the figure after all components are created
app.UIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = ExampleWorkflowAbortAsyn
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
% Execute the startup function
runStartupFcn(app, @startupFcn)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end appdesigner, parallel computing toolbox, dataqueue, asynchronous MATLAB Answers — New Questions
How to modify the font size of files and variable interface in matlab 2025a.
How to modify the font size of files and variable interface in matlab 2025a.?
I can’t find this option.How to modify the font size of files and variable interface in matlab 2025a.?
I can’t find this option. How to modify the font size of files and variable interface in matlab 2025a.?
I can’t find this option. matlab 2025a MATLAB Answers — New Questions
Simscape missing in Simulink Library
I have Matlab 2021B installed on my pc. But I cannot find Simscape Electrical in the library of Simulink . How can I install it using the same license, kindly elaborate in detailsI have Matlab 2021B installed on my pc. But I cannot find Simscape Electrical in the library of Simulink . How can I install it using the same license, kindly elaborate in details I have Matlab 2021B installed on my pc. But I cannot find Simscape Electrical in the library of Simulink . How can I install it using the same license, kindly elaborate in details simscape MATLAB Answers — New Questions
stftLayer error: “Size of input in T dimension must be greater than or equal to window length” despite correct input shape
Hi everyone,
I’m encountering a confusing issue when using the stftLayer in MATLAB’s Deep Learning Toolbox. I’m trying to pass a dlarray signal to an stftLayer inside a dlnetwork. The input signal has size:
size(signal) – [1 24 2401]
dims(signal) – ‘CBT’
The stfftLayer configuration is:
winLength = 256;
overlap = 128;
fftLength = 256;
stft_net = [sequenceInputLayer(size(signal,1))
stftLayer("Window",winLength,"FFTLength",fftLength,"OverlapLength",overlap,"Name","stft")];
stftNet = dlnetwork(stft_net);
However, when I am trying to use this model, I am receiving the following error:
Error using stftLayer/validateProperties (line 238)
Window length must be greater than one sample.
Error in stftLayer (line 166)
this = validateProperties(this);
^^^^^^^^^^^^^^^^^^^^^^^^
The signal properties are shown below for further clarity
K>> size(signal)
ans =
1 24 2401
K>> dims(signal)
ans =
‘CBT’
What could be causing the stftLayer to misinterpret the time dimension and throw the error, even when T is clearly larger than the window length? Any insights would be much appreciated.Hi everyone,
I’m encountering a confusing issue when using the stftLayer in MATLAB’s Deep Learning Toolbox. I’m trying to pass a dlarray signal to an stftLayer inside a dlnetwork. The input signal has size:
size(signal) – [1 24 2401]
dims(signal) – ‘CBT’
The stfftLayer configuration is:
winLength = 256;
overlap = 128;
fftLength = 256;
stft_net = [sequenceInputLayer(size(signal,1))
stftLayer("Window",winLength,"FFTLength",fftLength,"OverlapLength",overlap,"Name","stft")];
stftNet = dlnetwork(stft_net);
However, when I am trying to use this model, I am receiving the following error:
Error using stftLayer/validateProperties (line 238)
Window length must be greater than one sample.
Error in stftLayer (line 166)
this = validateProperties(this);
^^^^^^^^^^^^^^^^^^^^^^^^
The signal properties are shown below for further clarity
K>> size(signal)
ans =
1 24 2401
K>> dims(signal)
ans =
‘CBT’
What could be causing the stftLayer to misinterpret the time dimension and throw the error, even when T is clearly larger than the window length? Any insights would be much appreciated. Hi everyone,
I’m encountering a confusing issue when using the stftLayer in MATLAB’s Deep Learning Toolbox. I’m trying to pass a dlarray signal to an stftLayer inside a dlnetwork. The input signal has size:
size(signal) – [1 24 2401]
dims(signal) – ‘CBT’
The stfftLayer configuration is:
winLength = 256;
overlap = 128;
fftLength = 256;
stft_net = [sequenceInputLayer(size(signal,1))
stftLayer("Window",winLength,"FFTLength",fftLength,"OverlapLength",overlap,"Name","stft")];
stftNet = dlnetwork(stft_net);
However, when I am trying to use this model, I am receiving the following error:
Error using stftLayer/validateProperties (line 238)
Window length must be greater than one sample.
Error in stftLayer (line 166)
this = validateProperties(this);
^^^^^^^^^^^^^^^^^^^^^^^^
The signal properties are shown below for further clarity
K>> size(signal)
ans =
1 24 2401
K>> dims(signal)
ans =
‘CBT’
What could be causing the stftLayer to misinterpret the time dimension and throw the error, even when T is clearly larger than the window length? Any insights would be much appreciated. stftlayer, deep learning, signal processing MATLAB Answers — New Questions
Version 2025a does not open the editor.
How can I make version 2025a read the session history and open the editor with the previously opened files?
After installation, a new prefdir is created for 2025, and all files from the 2024 version directory are transferred to it — including MATLABDesktop.xml, MATLAB_Editor_State.xml, History.xml, etc. However, the editor does not open.
Ctrl-Shift-0 doesn’t work either.
I tried deleting the 2025 version’s prefdir, but that didn’t change the situation.
What should I do? I’d prefer not to open dozens of files manually.How can I make version 2025a read the session history and open the editor with the previously opened files?
After installation, a new prefdir is created for 2025, and all files from the 2024 version directory are transferred to it — including MATLABDesktop.xml, MATLAB_Editor_State.xml, History.xml, etc. However, the editor does not open.
Ctrl-Shift-0 doesn’t work either.
I tried deleting the 2025 version’s prefdir, but that didn’t change the situation.
What should I do? I’d prefer not to open dozens of files manually. How can I make version 2025a read the session history and open the editor with the previously opened files?
After installation, a new prefdir is created for 2025, and all files from the 2024 version directory are transferred to it — including MATLABDesktop.xml, MATLAB_Editor_State.xml, History.xml, etc. However, the editor does not open.
Ctrl-Shift-0 doesn’t work either.
I tried deleting the 2025 version’s prefdir, but that didn’t change the situation.
What should I do? I’d prefer not to open dozens of files manually. 2025a editor MATLAB Answers — New Questions
Step wise execution of “Transmit and Receive Tone Using AMD RFSoC Device” for ZCU208 RFSoC Board
Hi,
Kindly, provide step by step wise execution of "Transmit and Receive Tone Using AMD RFSoC Device" for ZCU208 RFSoC Board bcoz ,I have just started using RFSoC & MATLAB recently and have read out ADC out via System Generator(Simulink).Hi,
Kindly, provide step by step wise execution of "Transmit and Receive Tone Using AMD RFSoC Device" for ZCU208 RFSoC Board bcoz ,I have just started using RFSoC & MATLAB recently and have read out ADC out via System Generator(Simulink). Hi,
Kindly, provide step by step wise execution of "Transmit and Receive Tone Using AMD RFSoC Device" for ZCU208 RFSoC Board bcoz ,I have just started using RFSoC & MATLAB recently and have read out ADC out via System Generator(Simulink). transmit and receive tone using amd rfsoc device MATLAB Answers — New Questions
Modifying Simscape Initial Conditions
We receive a simscape plant model together with a .mat file containing the initial conditions.
We want to place that simscape model into a subsystem, connect it to a controller model, and save the combined model as a different model name.
The Initial Conditions variable is a structure array with .signals.blockName and .signals.stateName fields containing the full path of the simscape blocks. For example
>> disp(InitialConditions.signals(10).blockName)
Architecture_Delivery2/C11/Bulk Heater
and
>> disp(MissionProfile_InitialConditions.signals(10).stateName)
Architecture_Delivery2.C11.Bulk_Heater.BH_3_.p_I
All well and good – I’ve written a simple function to strrep() from the original model/path names to the new model/path names. This works most of the time. However occasionally I see a stateName like this:
>> disp(InitialConditions.signals(2).stateName)
Architecture_Delivery2.Simulink_PS_Converter14.outputFiltered_3445558726_0
and when I save the model, the numbers at the end can change (sometimes, not always). This means that the model fails to initialise as it can’t find the correct stateName.
Unable to load the specified initial state for model ‘Combined_Plant_Controller’. BlockName/BlockPath of the element at index 2 in the initial state is invalid
Note that this error is incorrect – it’s not the Block Name/Path that’s incorrect but the State Name/Path.
So, my questions are;
Why do some blocks have seemingly random numbers appended to the stateName and others don’t?
Is there a way to programmatically examine a model to find out what number has been given to a block’s stateName so that I can update the initial conditions variable correctly?We receive a simscape plant model together with a .mat file containing the initial conditions.
We want to place that simscape model into a subsystem, connect it to a controller model, and save the combined model as a different model name.
The Initial Conditions variable is a structure array with .signals.blockName and .signals.stateName fields containing the full path of the simscape blocks. For example
>> disp(InitialConditions.signals(10).blockName)
Architecture_Delivery2/C11/Bulk Heater
and
>> disp(MissionProfile_InitialConditions.signals(10).stateName)
Architecture_Delivery2.C11.Bulk_Heater.BH_3_.p_I
All well and good – I’ve written a simple function to strrep() from the original model/path names to the new model/path names. This works most of the time. However occasionally I see a stateName like this:
>> disp(InitialConditions.signals(2).stateName)
Architecture_Delivery2.Simulink_PS_Converter14.outputFiltered_3445558726_0
and when I save the model, the numbers at the end can change (sometimes, not always). This means that the model fails to initialise as it can’t find the correct stateName.
Unable to load the specified initial state for model ‘Combined_Plant_Controller’. BlockName/BlockPath of the element at index 2 in the initial state is invalid
Note that this error is incorrect – it’s not the Block Name/Path that’s incorrect but the State Name/Path.
So, my questions are;
Why do some blocks have seemingly random numbers appended to the stateName and others don’t?
Is there a way to programmatically examine a model to find out what number has been given to a block’s stateName so that I can update the initial conditions variable correctly? We receive a simscape plant model together with a .mat file containing the initial conditions.
We want to place that simscape model into a subsystem, connect it to a controller model, and save the combined model as a different model name.
The Initial Conditions variable is a structure array with .signals.blockName and .signals.stateName fields containing the full path of the simscape blocks. For example
>> disp(InitialConditions.signals(10).blockName)
Architecture_Delivery2/C11/Bulk Heater
and
>> disp(MissionProfile_InitialConditions.signals(10).stateName)
Architecture_Delivery2.C11.Bulk_Heater.BH_3_.p_I
All well and good – I’ve written a simple function to strrep() from the original model/path names to the new model/path names. This works most of the time. However occasionally I see a stateName like this:
>> disp(InitialConditions.signals(2).stateName)
Architecture_Delivery2.Simulink_PS_Converter14.outputFiltered_3445558726_0
and when I save the model, the numbers at the end can change (sometimes, not always). This means that the model fails to initialise as it can’t find the correct stateName.
Unable to load the specified initial state for model ‘Combined_Plant_Controller’. BlockName/BlockPath of the element at index 2 in the initial state is invalid
Note that this error is incorrect – it’s not the Block Name/Path that’s incorrect but the State Name/Path.
So, my questions are;
Why do some blocks have seemingly random numbers appended to the stateName and others don’t?
Is there a way to programmatically examine a model to find out what number has been given to a block’s stateName so that I can update the initial conditions variable correctly? simscape, initialization MATLAB Answers — New Questions
How do I use fprintf to show the entire array in one ouput statement
>>
A = [-4 2 -7 6 8; 4 -5 8 -1 0; 0 -4 3 1 10; -8 7 -10 5 -2];
[rows cols] = size(A);
Z = zeros(size(A));
for x = 1:1:rows
for y = 1:1:cols
if A(x,y) <= 4
Z(x,y) = A(x,y);
end
end
end
fprintf(‘%in’,Z);
My ouput statement I am getting is
-4
4
0
-8
2
-5
-4
0
-7
0
3
-10
0
-1
1
0
0
0
0
-2
Instead of
-4 2 -7 0 0
4 -5 0 -1 0
0 -4 3 1 0
-8 0 -10 0 -2>>
A = [-4 2 -7 6 8; 4 -5 8 -1 0; 0 -4 3 1 10; -8 7 -10 5 -2];
[rows cols] = size(A);
Z = zeros(size(A));
for x = 1:1:rows
for y = 1:1:cols
if A(x,y) <= 4
Z(x,y) = A(x,y);
end
end
end
fprintf(‘%in’,Z);
My ouput statement I am getting is
-4
4
0
-8
2
-5
-4
0
-7
0
3
-10
0
-1
1
0
0
0
0
-2
Instead of
-4 2 -7 0 0
4 -5 0 -1 0
0 -4 3 1 0
-8 0 -10 0 -2 >>
A = [-4 2 -7 6 8; 4 -5 8 -1 0; 0 -4 3 1 10; -8 7 -10 5 -2];
[rows cols] = size(A);
Z = zeros(size(A));
for x = 1:1:rows
for y = 1:1:cols
if A(x,y) <= 4
Z(x,y) = A(x,y);
end
end
end
fprintf(‘%in’,Z);
My ouput statement I am getting is
-4
4
0
-8
2
-5
-4
0
-7
0
3
-10
0
-1
1
0
0
0
0
-2
Instead of
-4 2 -7 0 0
4 -5 0 -1 0
0 -4 3 1 0
-8 0 -10 0 -2 array, fprintf array, matrix, matrix array, fprintf matrix MATLAB Answers — New Questions
Error creating an FMU from a “Neural State Space Model” block
We are not able to create an FMU from from a "Neural State Space Model" block. The error that appears is:
Error:Invalid "()" reference for the "IDNEURALSTATESPACE" model.
We can run the block in Simulink perfectly but when we click also "Refresh" in the FMU settings, this error appears.
We do not have any problem for example creating an FMU with "Stateful Predict" block.We are not able to create an FMU from from a "Neural State Space Model" block. The error that appears is:
Error:Invalid "()" reference for the "IDNEURALSTATESPACE" model.
We can run the block in Simulink perfectly but when we click also "Refresh" in the FMU settings, this error appears.
We do not have any problem for example creating an FMU with "Stateful Predict" block. We are not able to create an FMU from from a "Neural State Space Model" block. The error that appears is:
Error:Invalid "()" reference for the "IDNEURALSTATESPACE" model.
We can run the block in Simulink perfectly but when we click also "Refresh" in the FMU settings, this error appears.
We do not have any problem for example creating an FMU with "Stateful Predict" block. fmu, neural network MATLAB Answers — New Questions
Why am I getting an error installing MATLAB on Ubuntu 24.04
I have just tried to download MATLAB onto Ubuntu 24.04 and it is not working.
When I run ./install within matlab_R2024a_Linux, this is the output:
terminate called after throwing an instance of ‘std::runtime_error’
what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 1
Aborted (core dumped)
When I then run ./bin/glnxa64/MATLABWindow , this is the output:
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29′ not found (required by /lib/x86_64-linux-gnu/libgallium-24.2.1 – kisak-mesa PPA.so)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29′ not found (required by /lib/x86_64-linux-gnu/libLLVM-17.so.1)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `CXXABI_1.3.13′ not found (required by /lib/x86_64-linux-gnu/libLLVM-17.so.1)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.30′ not found (required by /lib/x86_64-linux-gnu/libLLVM-17.so.1)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.30′ not found (required by /lib/x86_64-linux-gnu/libicuuc.so.74)
I have tried reading through these guides:
https://www.mathworks.com/matlabcentral/answers/2018166-what-dependencies-are-needed-to-install-matlab-on-minimal-or-core-linux-installations
https://www.mathworks.com/matlabcentral/answers/540707-why-does-matlab-fail-to-install-with-a-std-runtime_error-what-unable-to-launch-the-matlabwind
I have tried other solutions on Stack Over flow and nothing has worked.I have just tried to download MATLAB onto Ubuntu 24.04 and it is not working.
When I run ./install within matlab_R2024a_Linux, this is the output:
terminate called after throwing an instance of ‘std::runtime_error’
what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 1
Aborted (core dumped)
When I then run ./bin/glnxa64/MATLABWindow , this is the output:
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29′ not found (required by /lib/x86_64-linux-gnu/libgallium-24.2.1 – kisak-mesa PPA.so)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29′ not found (required by /lib/x86_64-linux-gnu/libLLVM-17.so.1)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `CXXABI_1.3.13′ not found (required by /lib/x86_64-linux-gnu/libLLVM-17.so.1)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.30′ not found (required by /lib/x86_64-linux-gnu/libLLVM-17.so.1)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.30′ not found (required by /lib/x86_64-linux-gnu/libicuuc.so.74)
I have tried reading through these guides:
https://www.mathworks.com/matlabcentral/answers/2018166-what-dependencies-are-needed-to-install-matlab-on-minimal-or-core-linux-installations
https://www.mathworks.com/matlabcentral/answers/540707-why-does-matlab-fail-to-install-with-a-std-runtime_error-what-unable-to-launch-the-matlabwind
I have tried other solutions on Stack Over flow and nothing has worked. I have just tried to download MATLAB onto Ubuntu 24.04 and it is not working.
When I run ./install within matlab_R2024a_Linux, this is the output:
terminate called after throwing an instance of ‘std::runtime_error’
what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 1
Aborted (core dumped)
When I then run ./bin/glnxa64/MATLABWindow , this is the output:
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29′ not found (required by /lib/x86_64-linux-gnu/libgallium-24.2.1 – kisak-mesa PPA.so)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29′ not found (required by /lib/x86_64-linux-gnu/libLLVM-17.so.1)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `CXXABI_1.3.13′ not found (required by /lib/x86_64-linux-gnu/libLLVM-17.so.1)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.30′ not found (required by /lib/x86_64-linux-gnu/libLLVM-17.so.1)
./bin/glnxa64/MATLABWindow: /home/eric1/Downloads/matlab_R2024a_Linux/bin/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.30′ not found (required by /lib/x86_64-linux-gnu/libicuuc.so.74)
I have tried reading through these guides:
https://www.mathworks.com/matlabcentral/answers/2018166-what-dependencies-are-needed-to-install-matlab-on-minimal-or-core-linux-installations
https://www.mathworks.com/matlabcentral/answers/540707-why-does-matlab-fail-to-install-with-a-std-runtime_error-what-unable-to-launch-the-matlabwind
I have tried other solutions on Stack Over flow and nothing has worked. ubuntu 24.04, installation MATLAB Answers — New Questions
Simulink and Git – Compare branches
Is there any way to compare Git branches on a Simulink project? In other words, show which files are different before merging.Is there any way to compare Git branches on a Simulink project? In other words, show which files are different before merging. Is there any way to compare Git branches on a Simulink project? In other words, show which files are different before merging. git MATLAB Answers — New Questions
making the graphic smaller
hello, i am using the version 2024b, and i need help with something. in my figure window there’s an ekg signal and i want to make the ekg signal smaller only, not the figure window. scaling didnt help, maybe i did it wrong? i want it to look like the ones u get at the hospital; big paper, small looking signal. any tips?hello, i am using the version 2024b, and i need help with something. in my figure window there’s an ekg signal and i want to make the ekg signal smaller only, not the figure window. scaling didnt help, maybe i did it wrong? i want it to look like the ones u get at the hospital; big paper, small looking signal. any tips? hello, i am using the version 2024b, and i need help with something. in my figure window there’s an ekg signal and i want to make the ekg signal smaller only, not the figure window. scaling didnt help, maybe i did it wrong? i want it to look like the ones u get at the hospital; big paper, small looking signal. any tips? ekg, scaling figure MATLAB Answers — New Questions
If I replace old version (R14) running on a 20 y.o laptop with Windows 7 with all new laptop, newest Windows and latest Matlab version, will my old toolboxes still be useable?
If I completely replace my old computer, windows 7 and R14 with the latest and greatest system and version, plus newest Windows, do I need to also buy the toolboxes that are part of my FSAE advisory and teaching package? Cost is not a high priority as much as will my dozens of old Vehicle Dynamics GUI and Fortran based packages still run, be salvagable, or do I start all over with the latest features ?If I completely replace my old computer, windows 7 and R14 with the latest and greatest system and version, plus newest Windows, do I need to also buy the toolboxes that are part of my FSAE advisory and teaching package? Cost is not a high priority as much as will my dozens of old Vehicle Dynamics GUI and Fortran based packages still run, be salvagable, or do I start all over with the latest features ? If I completely replace my old computer, windows 7 and R14 with the latest and greatest system and version, plus newest Windows, do I need to also buy the toolboxes that are part of my FSAE advisory and teaching package? Cost is not a high priority as much as will my dozens of old Vehicle Dynamics GUI and Fortran based packages still run, be salvagable, or do I start all over with the latest features ? replacement MATLAB Answers — New Questions









