Category: News
Simscape Multibody – Error “Model not assembled due to a position violation” when I change the value of the actuation input of a RevoluteJoint
Hi,
i am currently trying my first major project in Simscape (delta robot).
I want to adjust the angles of the joints RevoluteJoint2, 3 and 4 via three inputs. When I do that I get the mentioned error. If all joints have the same input value, no error occurs.
Can someone tell me why the error occurs? Thank you.
Project:
Is attached.
Error message:
"An error occurred while running the simulation and the simulation was terminated
Caused by:
[‘untitled_ohneCad/Solver Configuration’]: Model not assembled due to a position violation. The failure occurred during the attempt to assemble all joints in the system and satisfy any motion inputs. If an Update Diagram operation completes successfully, the failure is likely caused by motion inputs. Consider adjusting the motion inputs to specify a different starting configuration. Also consider adjusting or adding joint targets to better guide the assembly."Hi,
i am currently trying my first major project in Simscape (delta robot).
I want to adjust the angles of the joints RevoluteJoint2, 3 and 4 via three inputs. When I do that I get the mentioned error. If all joints have the same input value, no error occurs.
Can someone tell me why the error occurs? Thank you.
Project:
Is attached.
Error message:
"An error occurred while running the simulation and the simulation was terminated
Caused by:
[‘untitled_ohneCad/Solver Configuration’]: Model not assembled due to a position violation. The failure occurred during the attempt to assemble all joints in the system and satisfy any motion inputs. If an Update Diagram operation completes successfully, the failure is likely caused by motion inputs. Consider adjusting the motion inputs to specify a different starting configuration. Also consider adjusting or adding joint targets to better guide the assembly." Hi,
i am currently trying my first major project in Simscape (delta robot).
I want to adjust the angles of the joints RevoluteJoint2, 3 and 4 via three inputs. When I do that I get the mentioned error. If all joints have the same input value, no error occurs.
Can someone tell me why the error occurs? Thank you.
Project:
Is attached.
Error message:
"An error occurred while running the simulation and the simulation was terminated
Caused by:
[‘untitled_ohneCad/Solver Configuration’]: Model not assembled due to a position violation. The failure occurred during the attempt to assemble all joints in the system and satisfy any motion inputs. If an Update Diagram operation completes successfully, the failure is likely caused by motion inputs. Consider adjusting the motion inputs to specify a different starting configuration. Also consider adjusting or adding joint targets to better guide the assembly." model position violation, delta robot MATLAB Answers — New Questions
How to find the model of a black box with a known input and output signature of signal.
Please help me identify the model of a black box with a known input x(t) and output y(t), using the provided DATA.mat.
I have attempted to map the output to the given input using MATLAB System Identification Toolbox and neural networks, as described in the application section, but have not been successful.
Kindly assist in mapping this input to the output. You are free to use any methods.
Attacked input and output data.Please help me identify the model of a black box with a known input x(t) and output y(t), using the provided DATA.mat.
I have attempted to map the output to the given input using MATLAB System Identification Toolbox and neural networks, as described in the application section, but have not been successful.
Kindly assist in mapping this input to the output. You are free to use any methods.
Attacked input and output data. Please help me identify the model of a black box with a known input x(t) and output y(t), using the provided DATA.mat.
I have attempted to map the output to the given input using MATLAB System Identification Toolbox and neural networks, as described in the application section, but have not been successful.
Kindly assist in mapping this input to the output. You are free to use any methods.
Attacked input and output data. system identification, signal processing MATLAB Answers — New Questions
USB callback “terminator” fails to trigger a read when messages are close together
My App Designer program uses USB communication to an Arduino
It usually works but every once in a while Matlab fails to read.
configureCallback(app.PicoCom,"terminator",@app.PicoInput);
…
function PicoInput(app,src,~)
% check if there is more than 1 line. For some reason I don’t get another callback!!!
while (app.PicoCom.NumBytesAvailable>0)
raw = readline(src);
I’ve already added the while loop which mostly fixed it except if the messages are 20msec apart.
The only time it fails (and not very often) is between 2 messages that are known to be 20 ms apart.
When it fails (App Designer says "Run" … no action), I can go into the debugger (with a special pause I put in to read app properties) and check with
K>> app.PicoCom
ans =
Serialport with properties:
Port: "COM6"
BaudRate: 57600
NumBytesAvailable: 11
K>> read(app.PicoCom,11,"char")
ans =
‘z73851718
‘
And there it sits, not being read.
Sure, there are probably work arounds (I’m open to suggestions to manage it now) but isn’t this a bug!
My next attempt to handle this is to add a pause(0.03); at the end of the while loop but this is very unsatisfying and how do I know it will NEVER fail?My App Designer program uses USB communication to an Arduino
It usually works but every once in a while Matlab fails to read.
configureCallback(app.PicoCom,"terminator",@app.PicoInput);
…
function PicoInput(app,src,~)
% check if there is more than 1 line. For some reason I don’t get another callback!!!
while (app.PicoCom.NumBytesAvailable>0)
raw = readline(src);
I’ve already added the while loop which mostly fixed it except if the messages are 20msec apart.
The only time it fails (and not very often) is between 2 messages that are known to be 20 ms apart.
When it fails (App Designer says "Run" … no action), I can go into the debugger (with a special pause I put in to read app properties) and check with
K>> app.PicoCom
ans =
Serialport with properties:
Port: "COM6"
BaudRate: 57600
NumBytesAvailable: 11
K>> read(app.PicoCom,11,"char")
ans =
‘z73851718
‘
And there it sits, not being read.
Sure, there are probably work arounds (I’m open to suggestions to manage it now) but isn’t this a bug!
My next attempt to handle this is to add a pause(0.03); at the end of the while loop but this is very unsatisfying and how do I know it will NEVER fail? My App Designer program uses USB communication to an Arduino
It usually works but every once in a while Matlab fails to read.
configureCallback(app.PicoCom,"terminator",@app.PicoInput);
…
function PicoInput(app,src,~)
% check if there is more than 1 line. For some reason I don’t get another callback!!!
while (app.PicoCom.NumBytesAvailable>0)
raw = readline(src);
I’ve already added the while loop which mostly fixed it except if the messages are 20msec apart.
The only time it fails (and not very often) is between 2 messages that are known to be 20 ms apart.
When it fails (App Designer says "Run" … no action), I can go into the debugger (with a special pause I put in to read app properties) and check with
K>> app.PicoCom
ans =
Serialport with properties:
Port: "COM6"
BaudRate: 57600
NumBytesAvailable: 11
K>> read(app.PicoCom,11,"char")
ans =
‘z73851718
‘
And there it sits, not being read.
Sure, there are probably work arounds (I’m open to suggestions to manage it now) but isn’t this a bug!
My next attempt to handle this is to add a pause(0.03); at the end of the while loop but this is very unsatisfying and how do I know it will NEVER fail? usb terminate based callback fails occasionally MATLAB Answers — New Questions
Unable to change TLS version on Event Hub related to Azure Purview account
I have a event hub that is related to Azure Purview account. I can’t change the TLS version on it because there is a deny rbac permission set on it which denies access to all other accounts except the Azure Purview app itself. From what I am reading, it seems that for Microsoft Purview accounts was created before December 15th, 2022 the Event Hub is a managed resource and is provisioned during the Microsoft Purview account provisioning. Is there anyway to modfiy the permissions on it to allow me to change the TLS version.
Or, do I need to disable this event hub and configure my own event Hub? If so then how bets to set it up?
I have a event hub that is related to Azure Purview account. I can’t change the TLS version on it because there is a deny rbac permission set on it which denies access to all other accounts except the Azure Purview app itself. From what I am reading, it seems that for Microsoft Purview accounts was created before December 15th, 2022 the Event Hub is a managed resource and is provisioned during the Microsoft Purview account provisioning. Is there anyway to modfiy the permissions on it to allow me to change the TLS version.Or, do I need to disable this event hub and configure my own event Hub? If so then how bets to set it up? Read More
Microsoft 365 Apps for Enterprise – Auto sign in and Activation using Domain User Credentials
Hi,
I use shared computer activation but every new user who sign-in for the first time required to login with their account and do manual activation. it burdens users all the time to do this.
there is a way to do when a user logs in to Microsoft 365 Apps he will do it automatically in shared computer activation without him having to do all that.
i would love a solution using domain user credentials.
Rodriguez_591
Hi,I use shared computer activation but every new user who sign-in for the first time required to login with their account and do manual activation. it burdens users all the time to do this.there is a way to do when a user logs in to Microsoft 365 Apps he will do it automatically in shared computer activation without him having to do all that. i would love a solution using domain user credentials. Rodriguez_591 Read More
Sharing one drive
Hi, I have 1Tb one drive account and am saving all my photos from my samsung phone to there.
My husband also has a samsung phone and I want his phone to save his photo to my one drive account as well to keep the photos together.
I tried to log in with my email on his account but that would disconnect my phone. Two phones can’t be connected to the same onedrive account.
How could I save his photo to my one drive account?
Thanks
Hi, I have 1Tb one drive account and am saving all my photos from my samsung phone to there. My husband also has a samsung phone and I want his phone to save his photo to my one drive account as well to keep the photos together.I tried to log in with my email on his account but that would disconnect my phone. Two phones can’t be connected to the same onedrive account.How could I save his photo to my one drive account?Thanks Read More
Script for a sum of value drive by rules
Hi!
I have a matrix of data with only 0 and 0.2 values. I need to have the sum of successive 0.2 values (delta) for each columns of my matrix. Example: col1= 0 0 0 0.2 0.2 0.2 0.2 0 0 0.2 0 0.2 0.2 and the result_col1= 0.8 0.2 0.4. I write a script that works very well to do this (see above). First little problem, how can I say to my script that you need to read all columns of my matrix and put each correspondant delta values in my final matrix d?
Then, I would like to have a rule saying to the script "when you saw less than five zeros successively don’t stop to calculate delta". In my script, the calculation of delta stop when the script saw only one zero after a 0.2 value.
Thanks a lot.
Julien
T = importdata(‘data.xls’)
T= T.Feuil1;
d(1,:) = zeros(1,size(T,2));
j=1;
for individu=1:size(T,2)
for i=1:size(T,1);
if T(i,individu)== 0.2 || any(T(1:i))==0
d(j,individu) = d(j,individu)+T(i,individu);
elseif T(i)==0 && T(i-1)== 0.2
j= j+1;
d(j,individu) = 0;
end
end
j=1;
endHi!
I have a matrix of data with only 0 and 0.2 values. I need to have the sum of successive 0.2 values (delta) for each columns of my matrix. Example: col1= 0 0 0 0.2 0.2 0.2 0.2 0 0 0.2 0 0.2 0.2 and the result_col1= 0.8 0.2 0.4. I write a script that works very well to do this (see above). First little problem, how can I say to my script that you need to read all columns of my matrix and put each correspondant delta values in my final matrix d?
Then, I would like to have a rule saying to the script "when you saw less than five zeros successively don’t stop to calculate delta". In my script, the calculation of delta stop when the script saw only one zero after a 0.2 value.
Thanks a lot.
Julien
T = importdata(‘data.xls’)
T= T.Feuil1;
d(1,:) = zeros(1,size(T,2));
j=1;
for individu=1:size(T,2)
for i=1:size(T,1);
if T(i,individu)== 0.2 || any(T(1:i))==0
d(j,individu) = d(j,individu)+T(i,individu);
elseif T(i)==0 && T(i-1)== 0.2
j= j+1;
d(j,individu) = 0;
end
end
j=1;
end Hi!
I have a matrix of data with only 0 and 0.2 values. I need to have the sum of successive 0.2 values (delta) for each columns of my matrix. Example: col1= 0 0 0 0.2 0.2 0.2 0.2 0 0 0.2 0 0.2 0.2 and the result_col1= 0.8 0.2 0.4. I write a script that works very well to do this (see above). First little problem, how can I say to my script that you need to read all columns of my matrix and put each correspondant delta values in my final matrix d?
Then, I would like to have a rule saying to the script "when you saw less than five zeros successively don’t stop to calculate delta". In my script, the calculation of delta stop when the script saw only one zero after a 0.2 value.
Thanks a lot.
Julien
T = importdata(‘data.xls’)
T= T.Feuil1;
d(1,:) = zeros(1,size(T,2));
j=1;
for individu=1:size(T,2)
for i=1:size(T,1);
if T(i,individu)== 0.2 || any(T(1:i))==0
d(j,individu) = d(j,individu)+T(i,individu);
elseif T(i)==0 && T(i-1)== 0.2
j= j+1;
d(j,individu) = 0;
end
end
j=1;
end beginner MATLAB Answers — New Questions
Feature Request: Allow pinned tabs to redirect to a specific URL at each time browser restart.
Previously, I used “Install this site as an app” to install all the tools to my Windows start menu to create handy shortcuts. However, as time passes, there are too many online tools for daily use, and I think the start menu is no longer a good place for my tools. So, I’m trying to create several workspaces and pin tabs in Edge to solve my problem, and I think it works pretty well on first impression. Unfortunately, I am disappointed that the pinned tab doesn’t provide any option to set “always redirect to the specific URLs when the browser restarts”. It makes the whole workspace doesn’t work as I expected. So, I hope this feature will come up in the future.
Previously, I used “Install this site as an app” to install all the tools to my Windows start menu to create handy shortcuts. However, as time passes, there are too many online tools for daily use, and I think the start menu is no longer a good place for my tools. So, I’m trying to create several workspaces and pin tabs in Edge to solve my problem, and I think it works pretty well on first impression. Unfortunately, I am disappointed that the pinned tab doesn’t provide any option to set “always redirect to the specific URLs when the browser restarts”. It makes the whole workspace doesn’t work as I expected. So, I hope this feature will come up in the future. Read More
Write a Convolution function without using for loop and verify result using conv function.
Write a Convolution function with two inputs x[n] and h[n] without using for loop and verify result using conv function.Write a Convolution function with two inputs x[n] and h[n] without using for loop and verify result using conv function. Write a Convolution function with two inputs x[n] and h[n] without using for loop and verify result using conv function. convolution, signal processing, digital signal processing, system, dtft, electrical MATLAB Answers — New Questions
time shifting
i want the program to advance or delay the signal…
by taking input from user whether to advance or delay & by what number?….
please use switch statement?….
any signal like-ramp,step,exponential
in it i am using subplot to plot the original signal & shifted version of the signal..
i have a program something like this–
*clear all
close all
clc
disp(‘given function is’)
x=(-10:10);
for i=1:1:21
if(x(i)>0)
y(i)=exp(x(i));
else
y(i)=0;
end
end
subplot(1,2,1)
stem(x,y)
disp(‘enter whether to advance or delay’)
s=input(‘1>advancen 2>Delay’)
n=input(‘enter the no of step by which signal is to be shifted’)
switch(s)
case 1
[
for i=1+n:1:21+n
if(x(i)>0)
y(i)=1;
else
y(i)=0;
end
]
case 2
[
for i=1-n:1:21-n
if(x(i)>0)
y(i)=1;
else
y(i)=0;
end
]
subplot(1,2,2)
stem(x,y)
but when i run the program it gives error in the ‘for’ command in case 1.i want the program to advance or delay the signal…
by taking input from user whether to advance or delay & by what number?….
please use switch statement?….
any signal like-ramp,step,exponential
in it i am using subplot to plot the original signal & shifted version of the signal..
i have a program something like this–
*clear all
close all
clc
disp(‘given function is’)
x=(-10:10);
for i=1:1:21
if(x(i)>0)
y(i)=exp(x(i));
else
y(i)=0;
end
end
subplot(1,2,1)
stem(x,y)
disp(‘enter whether to advance or delay’)
s=input(‘1>advancen 2>Delay’)
n=input(‘enter the no of step by which signal is to be shifted’)
switch(s)
case 1
[
for i=1+n:1:21+n
if(x(i)>0)
y(i)=1;
else
y(i)=0;
end
]
case 2
[
for i=1-n:1:21-n
if(x(i)>0)
y(i)=1;
else
y(i)=0;
end
]
subplot(1,2,2)
stem(x,y)
but when i run the program it gives error in the ‘for’ command in case 1. i want the program to advance or delay the signal…
by taking input from user whether to advance or delay & by what number?….
please use switch statement?….
any signal like-ramp,step,exponential
in it i am using subplot to plot the original signal & shifted version of the signal..
i have a program something like this–
*clear all
close all
clc
disp(‘given function is’)
x=(-10:10);
for i=1:1:21
if(x(i)>0)
y(i)=exp(x(i));
else
y(i)=0;
end
end
subplot(1,2,1)
stem(x,y)
disp(‘enter whether to advance or delay’)
s=input(‘1>advancen 2>Delay’)
n=input(‘enter the no of step by which signal is to be shifted’)
switch(s)
case 1
[
for i=1+n:1:21+n
if(x(i)>0)
y(i)=1;
else
y(i)=0;
end
]
case 2
[
for i=1-n:1:21-n
if(x(i)>0)
y(i)=1;
else
y(i)=0;
end
]
subplot(1,2,2)
stem(x,y)
but when i run the program it gives error in the ‘for’ command in case 1. switch, homework MATLAB Answers — New Questions
Latest Canary Win 11 versions and Star Wars Outlaws (edited)
On my two computers running the latest versions of Canary, Star Wars Outlaws, recently released by Ubisoft, crashes. The game hangs (closes itself) even after several dozen seconds, regardless of in-game behavior, without any error message.I nterestingly, many other players on the Outlaws forums are complaining about the same issue in the Canary Insider build.
Perhaps some direction could be given by the information that this error does not appear in Windows 23h2 versions, but unfortunately it causes problems in 24h2 version. During a failure, I have no problems with overheating of the card/processor/board. I also exclude antivirus because I added the game to the exceptions. I also use the latest NVIDIA drivers.
On my two computers running the latest versions of Canary, Star Wars Outlaws, recently released by Ubisoft, crashes. The game hangs (closes itself) even after several dozen seconds, regardless of in-game behavior, without any error message.I nterestingly, many other players on the Outlaws forums are complaining about the same issue in the Canary Insider build.Perhaps some direction could be given by the information that this error does not appear in Windows 23h2 versions, but unfortunately it causes problems in 24h2 version. During a failure, I have no problems with overheating of the card/processor/board. I also exclude antivirus because I added the game to the exceptions. I also use the latest NVIDIA drivers. Read More
Problem with Excel for the Web
I need help with Excel for Web.
In my organization, it works fine for everyone else, but when I edit an Excel file, I need to be the first to enter it. If there is any other user, I get an error message stating that the file is locked and I can only view it in read-only mode.
If the other user closes the file, I can normally enter it, and the other user may also enter it.
Also, other users do not see this, and they can enter the file if they like in any order, etc.
I need help with Excel for Web. In my organization, it works fine for everyone else, but when I edit an Excel file, I need to be the first to enter it. If there is any other user, I get an error message stating that the file is locked and I can only view it in read-only mode. If the other user closes the file, I can normally enter it, and the other user may also enter it. Also, other users do not see this, and they can enter the file if they like in any order, etc. Read More
When I try to open office 365 I get a blank white screen. Urgent!
Guys please help!
When I try to open my office 365 I get a blank white screen. Just happened this morning.
I cant see my files.
I tried uninstalling office 365 and reinstalling it from the Microsoft store but it’s still blank.
What do I do?
Guys please help!When I try to open my office 365 I get a blank white screen. Just happened this morning.I cant see my files.I tried uninstalling office 365 and reinstalling it from the Microsoft store but it’s still blank.What do I do? Read More
Structure Work Items in Azure DevOps (Beginners question :) )
Hi guys,
we are using Azure DevOps since few months and everything so far. We are using the Agile Process with Epic, Features, User Stories and Tasks.
So for the main part everything is clear to me, when we add a new feature for our application I create a feature item, a user story to explain the business view with acceptance criteria and tasks for the specific work that needs to be done to implement this.
But now we have some task like refactoring this, developing basic functions in code we can use in different areas of the app, optimize code structure etc.
For that part I am not sure how to add work items that we can track the work, have everything transparent in AzureDevops and following the structure of the Agile Process with Features, User Stores, Tasks etc.
Is it like to have a Feature (Refactoring part xy in app) and a User Story like “As a developer I want to refactor this method in code that we can use it in any other party of the application”. And the creating tasks for it?
So is the user in this case the developer instead of the customer (the end user of the application)?
Would be nice to hear some ideas and your experience, how to handle this! 🙂
Thanks guys!
Flo
Hi guys, we are using Azure DevOps since few months and everything so far. We are using the Agile Process with Epic, Features, User Stories and Tasks. So for the main part everything is clear to me, when we add a new feature for our application I create a feature item, a user story to explain the business view with acceptance criteria and tasks for the specific work that needs to be done to implement this. But now we have some task like refactoring this, developing basic functions in code we can use in different areas of the app, optimize code structure etc.For that part I am not sure how to add work items that we can track the work, have everything transparent in AzureDevops and following the structure of the Agile Process with Features, User Stores, Tasks etc. Is it like to have a Feature (Refactoring part xy in app) and a User Story like “As a developer I want to refactor this method in code that we can use it in any other party of the application”. And the creating tasks for it? So is the user in this case the developer instead of the customer (the end user of the application)? Would be nice to hear some ideas and your experience, how to handle this! 🙂 Thanks guys!Flo Read More
Is there anyone working on electric powertrain 1-D simulation?
Hi guys, is there anyone working on electric powertrain 1-D simulation? I’m currently learning about 1-D scripting, modeling EV powertrains in both quasi-static and dynamic modes, traction motor & regenerative energy modeling, transmission & auto gear modeling, motor & battery cooling and HVAC system. So far, I’m using MATLAB and Simulink. I want to know if there are any other tools or processes I should learn in order to start a career in 1-D simulation for E-powertrains. Any advice or suggestions would be greatly appreciated.Hi guys, is there anyone working on electric powertrain 1-D simulation? I’m currently learning about 1-D scripting, modeling EV powertrains in both quasi-static and dynamic modes, traction motor & regenerative energy modeling, transmission & auto gear modeling, motor & battery cooling and HVAC system. So far, I’m using MATLAB and Simulink. I want to know if there are any other tools or processes I should learn in order to start a career in 1-D simulation for E-powertrains. Any advice or suggestions would be greatly appreciated. Hi guys, is there anyone working on electric powertrain 1-D simulation? I’m currently learning about 1-D scripting, modeling EV powertrains in both quasi-static and dynamic modes, traction motor & regenerative energy modeling, transmission & auto gear modeling, motor & battery cooling and HVAC system. So far, I’m using MATLAB and Simulink. I want to know if there are any other tools or processes I should learn in order to start a career in 1-D simulation for E-powertrains. Any advice or suggestions would be greatly appreciated. e-powertriain, bev, 1d simulation, matlab, simulink MATLAB Answers — New Questions
JSON Parsing
The output should be with 2 rows:
TVS1111 0 DBSSI ICICI addr1
TVS1111 0 DBSSI ICICI addr2
and we have to do JSON parsing for the below JSON string
declare @pJson NVARCHAR(MAX) = ‘{
“header”: {
“msgId”: “TVS1111”
},
“txnResponses”: [{
“chargesAmount”: “0”,
“senderParty”: {
“swiftBic”: “DBSSI”
},
“receivingParty”: {
“bankName”: “ICICI”,
“bankAddresses”: [{
“address”: “addr1”
},
{
“address”: “addr2”
}]
}
}]
}’
I attempted the following but it does not get the desired output
select
a.msgId,
b.chargesAmount,
b.senderPartyswiftBic,
b.receivingPartybankName,
c.address1
FROM OPENJSON(@pJson)
WITH
(
msgId VARCHAR(100) N’$.header.msgId’,
txnResponses NVARCHAR(MAX) AS JSON
) as a
CROSS APPLY OPENJSON(a.txnResponses)
WITH
(
chargesAmount VARCHAR(100) ‘$.chargesAmount’,
senderPartyswiftBic VARCHAR(100) ‘$.senderParty.swiftBic’,
receivingPartybankName VARCHAR(100) ‘$.receivingParty.bankName’,
bankAddresses NVARCHAR(MAX) AS JSON
) as b
CROSS APPLY OPENJSON(b.bankAddresses)
WITH (
address1 VARCHAR(100) ‘$.address’
) as c;
The output should be with 2 rows: TVS1111 0 DBSSI ICICI addr1TVS1111 0 DBSSI ICICI addr2 and we have to do JSON parsing for the below JSON string declare @pJson NVARCHAR(MAX) = ‘{ “header”: { “msgId”: “TVS1111” }, “txnResponses”: [{ “chargesAmount”: “0”, “senderParty”: { “swiftBic”: “DBSSI” }, “receivingParty”: { “bankName”: “ICICI”, “bankAddresses”: [{ “address”: “addr1” }, { “address”: “addr2” }] } }]}’ I attempted the following but it does not get the desired outputselect a.msgId, b.chargesAmount, b.senderPartyswiftBic, b.receivingPartybankName, c.address1FROM OPENJSON(@pJson)WITH( msgId VARCHAR(100) N’$.header.msgId’, txnResponses NVARCHAR(MAX) AS JSON) as aCROSS APPLY OPENJSON(a.txnResponses)WITH( chargesAmount VARCHAR(100) ‘$.chargesAmount’, senderPartyswiftBic VARCHAR(100) ‘$.senderParty.swiftBic’, receivingPartybankName VARCHAR(100) ‘$.receivingParty.bankName’, bankAddresses NVARCHAR(MAX) AS JSON) as bCROSS APPLY OPENJSON(b.bankAddresses)WITH ( address1 VARCHAR(100) ‘$.address’) as c; Read More
I am trying to implement a state space solution in Simulink with 1 variable m in matrix C, but the runtime error says Variable ‘m’ does not exist.
I am trying to implement a state space solution in Simulink with 1 variable m in matrix C, but the runtime error says Variable ‘m’ does not exist.
How to assign a value to the variable m?
The callback strings are A=[0 1;-2 -3]; B=[0 1]’; C=[1 0;0 m]; D=[0 ;0];’
Here’s the model I uploaded.I am trying to implement a state space solution in Simulink with 1 variable m in matrix C, but the runtime error says Variable ‘m’ does not exist.
How to assign a value to the variable m?
The callback strings are A=[0 1;-2 -3]; B=[0 1]’; C=[1 0;0 m]; D=[0 ;0];’
Here’s the model I uploaded. I am trying to implement a state space solution in Simulink with 1 variable m in matrix C, but the runtime error says Variable ‘m’ does not exist.
How to assign a value to the variable m?
The callback strings are A=[0 1;-2 -3]; B=[0 1]’; C=[1 0;0 m]; D=[0 ;0];’
Here’s the model I uploaded. simulink, state space MATLAB Answers — New Questions
Should table Indexing be Faster?
Example code.
t = combinations(0:10,0:10,0:10,0:10);
tic
for ii = 1:10
for jj = 1:height(t)
u = t{jj,:};
end
end
toc
tic
tcell = table2cell(t);
for ii = 1:10
for jj = 1:height(tcell)
u = [tcell{jj,:}];
end
end
toc
tic
tarr = table2array(t);
for ii = 1:10
for jj = 1:height(tarr)
u = tarr(jj,:);
end
end
toc
Any ideas why indexing into a table to extract data is so slow?Example code.
t = combinations(0:10,0:10,0:10,0:10);
tic
for ii = 1:10
for jj = 1:height(t)
u = t{jj,:};
end
end
toc
tic
tcell = table2cell(t);
for ii = 1:10
for jj = 1:height(tcell)
u = [tcell{jj,:}];
end
end
toc
tic
tarr = table2array(t);
for ii = 1:10
for jj = 1:height(tarr)
u = tarr(jj,:);
end
end
toc
Any ideas why indexing into a table to extract data is so slow? Example code.
t = combinations(0:10,0:10,0:10,0:10);
tic
for ii = 1:10
for jj = 1:height(t)
u = t{jj,:};
end
end
toc
tic
tcell = table2cell(t);
for ii = 1:10
for jj = 1:height(tcell)
u = [tcell{jj,:}];
end
end
toc
tic
tarr = table2array(t);
for ii = 1:10
for jj = 1:height(tarr)
u = tarr(jj,:);
end
end
toc
Any ideas why indexing into a table to extract data is so slow? tables, indexing MATLAB Answers — New Questions
Fading/shading an image
Good evening,
I had to darken half of a RGB image in order to recreate an emianopsy. Here is the code I used:
%Loss of left visus
A = imread(‘lena .bmp’);
[x,y,z]=size(A); %dimensions’ estraction RGB image
Y=y/2; % halving y axis
HSV = rgb2hsv(A); %conversion to hsv space
%Process the HSV image. This example decrease the brightness of half image by multiplying the V channel by a scale factor.
[h,s,v] = imsplit(HSV); %split hue, saturation and value channels
vFactor = 0.2; %define the scale factor for brightness
% for cicle darken pixels of the left part of the image
for i=1:x
for j=1:Y
v(i,j) = v(i,j)*vFactor;
end
end
HSV_v = cat(3,h,s,v); %reconstrucion of HSV image
%Convert the processed HSV image back to the RGB color space.
Av = hsv2rgb(HSV_v);
figure
imshow(Av)
title(‘Left emianopsy’);
Here is the resulting image:
The separation between the 2 parts of the image is too sharp and marked, so I’d like to obtain a more faded transition between the dark and the coloured side (like a gradient?). How can I obtain a realistic result? like for example the image below:
Thank you in advanceGood evening,
I had to darken half of a RGB image in order to recreate an emianopsy. Here is the code I used:
%Loss of left visus
A = imread(‘lena .bmp’);
[x,y,z]=size(A); %dimensions’ estraction RGB image
Y=y/2; % halving y axis
HSV = rgb2hsv(A); %conversion to hsv space
%Process the HSV image. This example decrease the brightness of half image by multiplying the V channel by a scale factor.
[h,s,v] = imsplit(HSV); %split hue, saturation and value channels
vFactor = 0.2; %define the scale factor for brightness
% for cicle darken pixels of the left part of the image
for i=1:x
for j=1:Y
v(i,j) = v(i,j)*vFactor;
end
end
HSV_v = cat(3,h,s,v); %reconstrucion of HSV image
%Convert the processed HSV image back to the RGB color space.
Av = hsv2rgb(HSV_v);
figure
imshow(Av)
title(‘Left emianopsy’);
Here is the resulting image:
The separation between the 2 parts of the image is too sharp and marked, so I’d like to obtain a more faded transition between the dark and the coloured side (like a gradient?). How can I obtain a realistic result? like for example the image below:
Thank you in advance Good evening,
I had to darken half of a RGB image in order to recreate an emianopsy. Here is the code I used:
%Loss of left visus
A = imread(‘lena .bmp’);
[x,y,z]=size(A); %dimensions’ estraction RGB image
Y=y/2; % halving y axis
HSV = rgb2hsv(A); %conversion to hsv space
%Process the HSV image. This example decrease the brightness of half image by multiplying the V channel by a scale factor.
[h,s,v] = imsplit(HSV); %split hue, saturation and value channels
vFactor = 0.2; %define the scale factor for brightness
% for cicle darken pixels of the left part of the image
for i=1:x
for j=1:Y
v(i,j) = v(i,j)*vFactor;
end
end
HSV_v = cat(3,h,s,v); %reconstrucion of HSV image
%Convert the processed HSV image back to the RGB color space.
Av = hsv2rgb(HSV_v);
figure
imshow(Av)
title(‘Left emianopsy’);
Here is the resulting image:
The separation between the 2 parts of the image is too sharp and marked, so I’d like to obtain a more faded transition between the dark and the coloured side (like a gradient?). How can I obtain a realistic result? like for example the image below:
Thank you in advance image processing, faded image, shade image, color transition MATLAB Answers — New Questions
App Designer has error in generated code
App designer places code (grayed out) that shows an error. I will note that the code ran fine before I saved and closed it out and then later restarted the app. I think the issue might be related to the fact that I had a callback that used the delete function which is used to close the app.
The line that show the syntax error is the following and bold in the full code listing:
app.RawdataPlotterAppUIFigure.CloseRequestFcn = createCallbackFcn(app, @delete(gcf), true);
Full code below:
classdef RawDataPlotterNew < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
RawdataPlotterAppUIFigure matlab.ui.Figure
GridLayout matlab.ui.container.GridLayout
LeftPanel matlab.ui.container.Panel
ControlPanel matlab.ui.container.Panel
SelectDataFileButton matlab.ui.control.Button
QuitButton matlab.ui.control.Button
ChannelSelectPanel matlab.ui.container.Panel
Select355CheckBox matlab.ui.control.CheckBox
Select532CheckBox matlab.ui.control.CheckBox
Select1064CheckBox matlab.ui.control.CheckBox
DelaysEditField matlab.ui.control.NumericEditField
DelaysEditFieldLabel matlab.ui.control.Label
StepDownButton matlab.ui.control.Button
AltMaxEditField matlab.ui.control.NumericEditField
AltMaxEditFieldLabel matlab.ui.control.Label
AltMinEditField matlab.ui.control.NumericEditField
AltMinEditFieldLabel matlab.ui.control.Label
CountsMaxEditField matlab.ui.control.NumericEditField
CountsMaxEditFieldLabel matlab.ui.control.Label
CountsMinEditField matlab.ui.control.NumericEditField
CountsMinEditFieldLabel matlab.ui.control.Label
AutoScaleYCheckBox matlab.ui.control.CheckBox
AutoScaleXCheckBox matlab.ui.control.CheckBox
LegendCheckBox matlab.ui.control.CheckBox
LogScaleCheckBox matlab.ui.control.CheckBox
RangeSquaredCheckBox matlab.ui.control.CheckBox
RunButton matlab.ui.control.StateButton
StepUpButton matlab.ui.control.Button
RecordEditField matlab.ui.control.NumericEditField
RecordEditFieldLabel matlab.ui.control.Label
TimeEditField matlab.ui.control.NumericEditField
TimeEditFieldLabel matlab.ui.control.Label
Channel4DropDown matlab.ui.control.DropDown
Channel4DropDownLabel matlab.ui.control.Label
Channel3DropDown matlab.ui.control.DropDown
Channel3DropDownLabel matlab.ui.control.Label
Channel2DropDown matlab.ui.control.DropDown
Channel2DropDownLabel matlab.ui.control.Label
Channel1DropDown matlab.ui.control.DropDown
Channel1DropDownLabel matlab.ui.control.Label
RightPanel matlab.ui.container.Panel
Panel4 matlab.ui.container.Panel
StatusEditField matlab.ui.control.EditField
StatusEditFieldLabel matlab.ui.control.Label
PathnameEditField matlab.ui.control.EditField
PathnameEditFieldLabel matlab.ui.control.Label
FilenameEditField matlab.ui.control.EditField
FilenameEditFieldLabel matlab.ui.control.Label
Panel3 matlab.ui.container.Panel
UIAxes matlab.ui.control.UIAxes
end
% Properties that correspond to apps with auto-reflow
properties (Access = private)
onePanelWidth = 576;
end
properties (Access = private)
FileName; % File for rawdata file being plotted
PathName; % Path for rawdata file being plotted
FullFileName; %Full filename
ChannelNames; %Names of the channels in data file
Altitude; %Altitude from raw data file
TimeUT; %time from rawdata file
SelectedChannels; %array of selected channels
CurrentRecord; %record index
CurrentTimeUT; %current time of data record
data; % data from selected channels
range; % range data for all PMT channels
range50; % range data for all APD channels
NumChannels = 4;
goodFileSelected = 0; %toggle to make sure a good file is selected
end
methods (Access = private)
function updatePlot(app)
getSelectedChannels(app)
for idx=1:app.NumChannels
if app.RangeSquaredCheckBox.Value
x = squeeze(app.data(:,app.CurrentRecord,idx));
else
if contains(app.SelectedChannels(idx),’1064′)
x = squeeze(app.data(:,app.CurrentRecord,idx))./(app.range50(:,app.CurrentRecord)).^2;
else
x = squeeze(app.data(:,app.CurrentRecord,idx))./(app.range(:,app.CurrentRecord)).^2;
end
end
plot(app.UIAxes,x,app.Altitude);
hold(app.UIAxes,’on’)
end
hold(app.UIAxes,’off’)
%scale axes
if app.AutoScaleXCheckBox.Value
xlim(app.UIAxes,[0,2^16]);
else
xlim(app.UIAxes, [app.CountsMinEditField.Value,app.CountsMaxEditField.Value]);
end
if app.AutoScaleYCheckBox.Value
ylim(app.UIAxes, [min(app.Altitude),max(app.Altitude)]);
else
ylim(app.UIAxes, [app.AltMinEditField.Value,app.AltMaxEditField.Value]);
end
%check log scale
if app.LogScaleCheckBox.Value == 1
xscale(app.UIAxes,"log");
else
xscale(app.UIAxes,"linear");
end
%add legend
if app.LegendCheckBox.Value
legend(app.UIAxes,app.SelectedChannels,’Interpreter’, ‘none’)
else
legend(app.UIAxes,’off’)
end
drawnow;
end
function getSelectedChannels(app)
channel(1) = app.Channel1DropDown.ValueIndex;
channel(2) = app.Channel2DropDown.ValueIndex;
channel(3) = app.Channel3DropDown.ValueIndex;
channel(4) = app.Channel4DropDown.ValueIndex;
for idx=1:app.NumChannels
app.SelectedChannels{idx} = app.ChannelNames{channel(idx)};
end
end
function updateData(app)
if app.goodFileSelected
%always update selected channels
getSelectedChannels(app);
for idx=1:app.NumChannels
if contains(app.SelectedChannels{idx},’None’)
app.data(:,:,idx) = NaN(size(app.Altitude,1),size(app.TimeUT,2));
else
dataName = [‘/CLDSData/’,app.SelectedChannels{idx}];
app.data(:,:,idx) = h5read(app.FullFileName,dataName);
end
end
else
app.StatusEditField.Value = ‘Not correct type of data file (LBW or HBW)’;
end
end
function updateDataSingleChannel(app,idx)
if app.goodFileSelected
%always update selected channels
getSelectedChannels(app);
if contains(app.SelectedChannels{idx},’None’)
app.data(:,:,idx) = NaN(size(app.Altitude,1),size(app.TimeUT,2));
else
dataName = [‘/CLDSData/’,app.SelectedChannels{idx}];
app.data(:,:,idx) = h5read(app.FullFileName,dataName);
end
else
app.StatusEditField.Value = ‘Not correct type of data file (LBW or HBW)’;
end
end
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
SelectDataFileButtonPushed(app, [])
end
% Button pushed function: QuitButton
function QuitButtonPushed(app, event)
delete(app)
end
% Button pushed function: SelectDataFileButton
function SelectDataFileButtonPushed(app, event)
defname = ‘/Users/Shared/Data/’;
[app.FileName,app.PathName] = uigetfile(‘.h5′,’Select H5 File’,defname);
app.FilenameEditField.Value = app.FileName;
app.PathnameEditField.Value = app.PathName;
app.FullFileName = fullfile(app.PathName,app.FileName);
%get channel names and populate the dropdown lists
%do try catch to see if data file is correct
try
app.ChannelNames = h5read(app.FullFileName,’/Channel_Names’);
selectIdx = contains(app.ChannelNames,’high’);
app.ChannelNames = app.ChannelNames(selectIdx);
app.ChannelNames = [{‘None’};app.ChannelNames];
app.Channel1DropDown.Items = app.ChannelNames;
app.Channel2DropDown.Items = app.ChannelNames;
app.Channel3DropDown.Items = app.ChannelNames;
app.Channel4DropDown.Items = app.ChannelNames;
catch
app.StatusEditField.Value = ‘Not correct type of data file (LBW or HBW)’;
end
%load in the altitude and time data
try
app.Altitude = h5read(app.FullFileName,’/DataProducts/Altitude’)/1000;
app.TimeUT = h5read(app.FullFileName,’/Nav_Data/gps_time’);
app.CurrentRecord = 1;
app.CurrentTimeUT = app.TimeUT(app.CurrentRecord);
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
app.RecordEditField.Value = app.CurrentRecord;
app.goodFileSelected = 1;
catch
app.StatusEditField.Value = ‘Issue reading altitude or time from data file’;
end
%get range data
app.range = h5read(app.FullFileName,’/UserInput/range_interp’);
app.range50 = h5read(app.FullFileName,’/UserInput/range50_interp’);
%initialize data array to NaN
app.data = NaN(size(app.Altitude,1),size(app.TimeUT,2),app.NumChannels);
%set limits on record and time values
app.RecordEditField.Limits = [1,size(app.TimeUT,2)];
app.TimeEditField.Limits = [min(app.TimeUT),max(app.TimeUT)];
%update data
updateData(app);
%plot data
updatePlot(app);
end
% Value changed function: RecordEditField
function RecordEditFieldValueChanged(app, event)
value = app.RecordEditField.Value;
app.CurrentRecord = value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
updatePlot(app)
end
% Value changed function: TimeEditField
function TimeEditFieldValueChanged(app, event)
value = app.TimeEditField.Value;
if value <= app.TimeUT(1,end)
idx = find(app.TimeUT>=value,1,’first’);
else
idx = size(app.TimeUT,2);
end
app.CurrentTimeUT = app.TimeUT(idx);
app.RecordValue.Value = idx;
updatePlot(app)
end
% Value changed function: Channel1DropDown
function Channel1DropDownValueChanged(app, event)
updateDataSingleChannel(app,1);
updatePlot(app);
end
% Value changed function: Channel2DropDown
function Channel2DropDownValueChanged(app, event)
updateDataSingleChannel(app,2);
updatePlot(app);
end
% Value changed function: Channel3DropDown
function Channel3DropDownValueChanged(app, event)
updateDataSingleChannel(app,3);
updatePlot(app);
end
% Value changed function: Channel4DropDown
function Channel4DropDownValueChanged(app, event)
updateDataSingleChannel(app,4);
updatePlot(app);
end
% Value changed function: LogScaleCheckBox
function LogScaleCheckBoxValueChanged(app, event)
updatePlot(app);
end
% Value changed function: LegendCheckBox
function LegendCheckBoxValueChanged(app, event)
updatePlot(app);
end
% Value changed function: CountsMaxEditField
function CountsMaxEditFieldValueChanged(app, event)
updatePlot(app)
end
% Value changed function: CountsMinEditField
function CountsMinEditFieldValueChanged(app, event)
updatePlot(app)
end
% Value changed function: AltMinEditField
function AltMinEditFieldValueChanged(app, event)
updatePlot(app)
end
% Value changed function: AltMaxEditField
function AltMaxEditFieldValueChanged(app, event)
updatePlot(app)
end
% Button pushed function: StepUpButton
function StepUpButtonPushed(app, event)
app.RecordEditField.Value = app.RecordEditField.Value+1;
app.CurrentRecord = app.RecordEditField.Value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
updatePlot(app)
end
% Button pushed function: StepDownButton
function StepDownButtonPushed(app, event)
app.RecordEditField.Value = app.RecordEditField.Value-1;
app.CurrentRecord = app.RecordEditField.Value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
updatePlot(app)
end
% Value changed function: RunButton
function RunButtonValueChanged(app, event)
value = app.RunButton.Value;
while value == 1
app.RunButton.Text = ‘Stop’;
app.RunButton.BackgroundColor = [1,0,0];
app.RecordEditField.Value = app.RecordEditField.Value+1;
app.CurrentRecord = app.RecordEditField.Value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
pause(app.DelaysEditField.Value)
updatePlot(app)
value = app.RunButton.Value;
end
app.RunButton.Text = ‘Run’;
app.RunButton.BackgroundColor = [0.96,0.96,0.96];
end
% Value changed function: Select1064CheckBox
function Select1064CheckBoxValueChanged(app, event)
%uncheck other wavelengths (only one possible)
app.Select532CheckBox.Value = 0;
app.Select355CheckBox.Value = 0;
%set dropdown lists for 1064
app.Channel1DropDown.ValueIndex = 2;
app.Channel2DropDown.ValueIndex = 3;
app.Channel3DropDown.ValueIndex = 1;
app.Channel4DropDown.ValueIndex = 1;
updateData(app);
updatePlot(app)
end
% Value changed function: Select532CheckBox
function Select532CheckBoxValueChanged(app, event)
%uncheck other wavelengths (only one possible)
app.Select1064CheckBox.Value = 0;
app.Select355CheckBox.Value = 0;
%set dropdown lists for 1064
app.Channel1DropDown.ValueIndex = 4;
app.Channel2DropDown.ValueIndex = 5;
app.Channel3DropDown.ValueIndex = 6;
app.Channel4DropDown.ValueIndex = 1;
updateData(app);
updatePlot(app);
end
% Value changed function: Select355CheckBox
function Select355CheckBoxValueChanged(app, event)
%uncheck other wavelengths (only one possible)
app.Select1064CheckBox.Value = 0;
app.Select532CheckBox.Value = 0;
%set dropdown lists for 1064
app.Channel1DropDown.ValueIndex = 7;
app.Channel2DropDown.ValueIndex = 8;
app.Channel3DropDown.ValueIndex = 9;
app.Channel4DropDown.ValueIndex = 10;
updateData(app);
updatePlot(app);
end
% Value changed function: DelaysEditField
function DelaysEditFieldValueChanged(app, event)
value = app.DelaysEditField.Value;
if value < 0.05
app.DelaysEditField.Value = 0.05;
end
end
% Changes arrangement of the app based on UIFigure width
function updateAppLayout(app, event)
currentFigureWidth = app.RawdataPlotterAppUIFigure.Position(3);
if(currentFigureWidth <= app.onePanelWidth)
% Change to a 2×1 grid
app.GridLayout.RowHeight = {642, 642};
app.GridLayout.ColumnWidth = {‘1x’};
app.RightPanel.Layout.Row = 2;
app.RightPanel.Layout.Column = 1;
else
% Change to a 1×2 grid
app.GridLayout.RowHeight = {‘1x’};
app.GridLayout.ColumnWidth = {220, ‘1x’};
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
end
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create RawdataPlotterAppUIFigure and hide until all components are created
app.RawdataPlotterAppUIFigure = uifigure(‘Visible’, ‘off’);
app.RawdataPlotterAppUIFigure.AutoResizeChildren = ‘off’;
app.RawdataPlotterAppUIFigure.Position = [100 100 719 642];
app.RawdataPlotterAppUIFigure.Name = ‘Rawdata Plotter App’;
app.RawdataPlotterAppUIFigure.CloseRequestFcn = createCallbackFcn(app, @delete(gcf), true); %MARKED
app.RawdataPlotterAppUIFigure.SizeChangedFcn = createCallbackFcn(app, @updateAppLayout, true);
% Create GridLayout
app.GridLayout = uigridlayout(app.RawdataPlotterAppUIFigure);
app.GridLayout.ColumnWidth = {220, ‘1x’};
app.GridLayout.RowHeight = {‘1x’};
app.GridLayout.ColumnSpacing = 0;
app.GridLayout.RowSpacing = 0;
app.GridLayout.Padding = [0 0 0 0];
app.GridLayout.Scrollable = ‘on’;
% Create LeftPanel
app.LeftPanel = uipanel(app.GridLayout);
app.LeftPanel.Layout.Row = 1;
app.LeftPanel.Layout.Column = 1;
% Create ChannelSelectPanel
app.ChannelSelectPanel = uipanel(app.LeftPanel);
app.ChannelSelectPanel.Title = ‘Channel Select’;
app.ChannelSelectPanel.Position = [9 132 203 502];
% Create Channel1DropDownLabel
app.Channel1DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel1DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel1DropDownLabel.Position = [19 446 59 22];
app.Channel1DropDownLabel.Text = ‘Channel 1’;
% Create Channel1DropDown
app.Channel1DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel1DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel1DropDownValueChanged, true);
app.Channel1DropDown.Position = [93 446 100 22];
% Create Channel2DropDownLabel
app.Channel2DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel2DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel2DropDownLabel.Position = [19 412 59 22];
app.Channel2DropDownLabel.Text = ‘Channel 2’;
% Create Channel2DropDown
app.Channel2DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel2DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel2DropDownValueChanged, true);
app.Channel2DropDown.Position = [93 412 100 22];
% Create Channel3DropDownLabel
app.Channel3DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel3DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel3DropDownLabel.Position = [19 378 59 22];
app.Channel3DropDownLabel.Text = ‘Channel 3’;
% Create Channel3DropDown
app.Channel3DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel3DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel3DropDownValueChanged, true);
app.Channel3DropDown.Position = [93 378 100 22];
% Create Channel4DropDownLabel
app.Channel4DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel4DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel4DropDownLabel.Position = [19 345 59 22];
app.Channel4DropDownLabel.Text = ‘Channel 4’;
% Create Channel4DropDown
app.Channel4DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel4DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel4DropDownValueChanged, true);
app.Channel4DropDown.Position = [93 345 100 22];
% Create TimeEditFieldLabel
app.TimeEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.TimeEditFieldLabel.HorizontalAlignment = ‘right’;
app.TimeEditFieldLabel.Position = [36 210 31 22];
app.TimeEditFieldLabel.Text = ‘Time’;
% Create TimeEditField
app.TimeEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.TimeEditField.ValueDisplayFormat = ‘%11.6g’;
app.TimeEditField.ValueChangedFcn = createCallbackFcn(app, @TimeEditFieldValueChanged, true);
app.TimeEditField.Position = [77 210 100 22];
% Create RecordEditFieldLabel
app.RecordEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.RecordEditFieldLabel.HorizontalAlignment = ‘right’;
app.RecordEditFieldLabel.Position = [25 185 44 22];
app.RecordEditFieldLabel.Text = ‘Record’;
% Create RecordEditField
app.RecordEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.RecordEditField.ValueChangedFcn = createCallbackFcn(app, @RecordEditFieldValueChanged, true);
app.RecordEditField.Position = [77 185 100 22];
% Create StepUpButton
app.StepUpButton = uibutton(app.ChannelSelectPanel, ‘push’);
app.StepUpButton.ButtonPushedFcn = createCallbackFcn(app, @StepUpButtonPushed, true);
app.StepUpButton.Position = [109 154 66 23];
app.StepUpButton.Text = ‘Step Up’;
% Create RunButton
app.RunButton = uibutton(app.ChannelSelectPanel, ‘state’);
app.RunButton.ValueChangedFcn = createCallbackFcn(app, @RunButtonValueChanged, true);
app.RunButton.Text = ‘Run’;
app.RunButton.Position = [57 8 60 23];
% Create RangeSquaredCheckBox
app.RangeSquaredCheckBox = uicheckbox(app.ChannelSelectPanel);
app.RangeSquaredCheckBox.Text = ‘Range Squared’;
app.RangeSquaredCheckBox.Position = [9 82 105 22];
% Create LogScaleCheckBox
app.LogScaleCheckBox = uicheckbox(app.ChannelSelectPanel);
app.LogScaleCheckBox.ValueChangedFcn = createCallbackFcn(app, @LogScaleCheckBoxValueChanged, true);
app.LogScaleCheckBox.Text = ‘Log Scale’;
app.LogScaleCheckBox.Position = [9 61 76 22];
app.LogScaleCheckBox.Value = true;
% Create LegendCheckBox
app.LegendCheckBox = uicheckbox(app.ChannelSelectPanel);
app.LegendCheckBox.ValueChangedFcn = createCallbackFcn(app, @LegendCheckBoxValueChanged, true);
app.LegendCheckBox.Text = ‘Legend’;
app.LegendCheckBox.Position = [9 40 62 22];
app.LegendCheckBox.Value = true;
% Create AutoScaleXCheckBox
app.AutoScaleXCheckBox = uicheckbox(app.ChannelSelectPanel);
app.AutoScaleXCheckBox.Text = ‘Auto Scale X’;
app.AutoScaleXCheckBox.Position = [9 123 91 22];
app.AutoScaleXCheckBox.Value = true;
% Create AutoScaleYCheckBox
app.AutoScaleYCheckBox = uicheckbox(app.ChannelSelectPanel);
app.AutoScaleYCheckBox.Text = ‘Auto Scale Y’;
app.AutoScaleYCheckBox.Position = [9 103 91 22];
app.AutoScaleYCheckBox.Value = true;
% Create CountsMinEditFieldLabel
app.CountsMinEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.CountsMinEditFieldLabel.HorizontalAlignment = ‘right’;
app.CountsMinEditFieldLabel.Position = [22 308 67 22];
app.CountsMinEditFieldLabel.Text = ‘Counts Min’;
% Create CountsMinEditField
app.CountsMinEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.CountsMinEditField.ValueChangedFcn = createCallbackFcn(app, @CountsMinEditFieldValueChanged, true);
app.CountsMinEditField.Position = [25 288 66 22];
app.CountsMinEditField.Value = 0.1;
% Create CountsMaxEditFieldLabel
app.CountsMaxEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.CountsMaxEditFieldLabel.HorizontalAlignment = ‘right’;
app.CountsMaxEditFieldLabel.Position = [104 308 70 22];
app.CountsMaxEditFieldLabel.Text = ‘Counts Max’;
% Create CountsMaxEditField
app.CountsMaxEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.CountsMaxEditField.ValueChangedFcn = createCallbackFcn(app, @CountsMaxEditFieldValueChanged, true);
app.CountsMaxEditField.Position = [104 288 70 22];
app.CountsMaxEditField.Value = 65536;
% Create AltMinEditFieldLabel
app.AltMinEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.AltMinEditFieldLabel.HorizontalAlignment = ‘right’;
app.AltMinEditFieldLabel.Position = [36 267 42 22];
app.AltMinEditFieldLabel.Text = ‘Alt Min’;
% Create AltMinEditField
app.AltMinEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.AltMinEditField.ValueChangedFcn = createCallbackFcn(app, @AltMinEditFieldValueChanged, true);
app.AltMinEditField.Position = [25 246 66 22];
app.AltMinEditField.Value = -500;
% Create AltMaxEditFieldLabel
app.AltMaxEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.AltMaxEditFieldLabel.HorizontalAlignment = ‘right’;
app.AltMaxEditFieldLabel.Position = [114 267 46 22];
app.AltMaxEditFieldLabel.Text = ‘Alt Max’;
% Create AltMaxEditField
app.AltMaxEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.AltMaxEditField.ValueChangedFcn = createCallbackFcn(app, @AltMaxEditFieldValueChanged, true);
app.AltMaxEditField.Position = [104 246 69 22];
app.AltMaxEditField.Value = 22000;
% Create StepDownButton
app.StepDownButton = uibutton(app.ChannelSelectPanel, ‘push’);
app.StepDownButton.ButtonPushedFcn = createCallbackFcn(app, @StepDownButtonPushed, true);
app.StepDownButton.Position = [24 154 75 23];
app.StepDownButton.Text = ‘Step Down’;
% Create DelaysEditFieldLabel
app.DelaysEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.DelaysEditFieldLabel.HorizontalAlignment = ‘right’;
app.DelaysEditFieldLabel.Position = [119 34 51 22];
app.DelaysEditFieldLabel.Text = ‘Delay (s)’;
% Create DelaysEditField
app.DelaysEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.DelaysEditField.ValueChangedFcn = createCallbackFcn(app, @DelaysEditFieldValueChanged, true);
app.DelaysEditField.Position = [128 9 34 22];
app.DelaysEditField.Value = 1;
% Create Select1064CheckBox
app.Select1064CheckBox = uicheckbox(app.ChannelSelectPanel);
app.Select1064CheckBox.ValueChangedFcn = createCallbackFcn(app, @Select1064CheckBoxValueChanged, true);
app.Select1064CheckBox.Text = ‘Select 1064’;
app.Select1064CheckBox.Position = [119 124 86 22];
% Create Select532CheckBox
app.Select532CheckBox = uicheckbox(app.ChannelSelectPanel);
app.Select532CheckBox.ValueChangedFcn = createCallbackFcn(app, @Select532CheckBoxValueChanged, true);
app.Select532CheckBox.Text = ‘Select 532’;
app.Select532CheckBox.Position = [119 101 79 22];
% Create Select355CheckBox
app.Select355CheckBox = uicheckbox(app.ChannelSelectPanel);
app.Select355CheckBox.ValueChangedFcn = createCallbackFcn(app, @Select355CheckBoxValueChanged, true);
app.Select355CheckBox.Text = ‘Select 355’;
app.Select355CheckBox.Position = [119 79 79 22];
% Create ControlPanel
app.ControlPanel = uipanel(app.LeftPanel);
app.ControlPanel.Title = ‘Control’;
app.ControlPanel.Position = [9 13 203 110];
% Create QuitButton
app.QuitButton = uibutton(app.ControlPanel, ‘push’);
app.QuitButton.ButtonPushedFcn = createCallbackFcn(app, @QuitButtonPushed, true);
app.QuitButton.FontWeight = ‘bold’;
app.QuitButton.FontColor = [1 0 0];
app.QuitButton.Position = [57 12 100 23];
app.QuitButton.Text = ‘Quit’;
% Create SelectDataFileButton
app.SelectDataFileButton = uibutton(app.ControlPanel, ‘push’);
app.SelectDataFileButton.ButtonPushedFcn = createCallbackFcn(app, @SelectDataFileButtonPushed, true);
app.SelectDataFileButton.Position = [57 54 100 23];
app.SelectDataFileButton.Text = ‘Select Data File’;
% Create RightPanel
app.RightPanel = uipanel(app.GridLayout);
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
% Create Panel3
app.Panel3 = uipanel(app.RightPanel);
app.Panel3.Title = ‘Panel3’;
app.Panel3.Position = [9 142 481 493];
% Create UIAxes
app.UIAxes = uiaxes(app.Panel3);
xlabel(app.UIAxes, ‘Counts’)
ylabel(app.UIAxes, ‘Altitude (km)’)
zlabel(app.UIAxes, ‘Z’)
app.UIAxes.GridLineWidth = 0.5;
app.UIAxes.MinorGridLineWidth = 0.5;
app.UIAxes.LineWidth = 0.5;
app.UIAxes.Box = ‘off’;
app.UIAxes.FontSize = 14;
app.UIAxes.Position = [4 0 475 469];
% Create Panel4
app.Panel4 = uipanel(app.RightPanel);
app.Panel4.Title = ‘Panel4’;
app.Panel4.Position = [9 10 479 123];
% Create FilenameEditFieldLabel
app.FilenameEditFieldLabel = uilabel(app.Panel4);
app.FilenameEditFieldLabel.HorizontalAlignment = ‘right’;
app.FilenameEditFieldLabel.Position = [14 75 53 22];
app.FilenameEditFieldLabel.Text = ‘Filename’;
% Create FilenameEditField
app.FilenameEditField = uieditfield(app.Panel4, ‘text’);
app.FilenameEditField.Position = [82 75 388 22];
% Create PathnameEditFieldLabel
app.PathnameEditFieldLabel = uilabel(app.Panel4);
app.PathnameEditFieldLabel.HorizontalAlignment = ‘right’;
app.PathnameEditFieldLabel.Position = [8 47 59 22];
app.PathnameEditFieldLabel.Text = ‘Pathname’;
% Create PathnameEditField
app.PathnameEditField = uieditfield(app.Panel4, ‘text’);
app.PathnameEditField.Position = [82 47 388 22];
% Create StatusEditFieldLabel
app.StatusEditFieldLabel = uilabel(app.Panel4);
app.StatusEditFieldLabel.HorizontalAlignment = ‘right’;
app.StatusEditFieldLabel.Position = [28 19 39 22];
app.StatusEditFieldLabel.Text = ‘Status’;
% Create StatusEditField
app.StatusEditField = uieditfield(app.Panel4, ‘text’);
app.StatusEditField.Position = [82 19 388 22];
% Show the figure after all components are created
app.RawdataPlotterAppUIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = RawDataPlotterNew
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.RawdataPlotterAppUIFigure)
% 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.RawdataPlotterAppUIFigure)
end
end
endApp designer places code (grayed out) that shows an error. I will note that the code ran fine before I saved and closed it out and then later restarted the app. I think the issue might be related to the fact that I had a callback that used the delete function which is used to close the app.
The line that show the syntax error is the following and bold in the full code listing:
app.RawdataPlotterAppUIFigure.CloseRequestFcn = createCallbackFcn(app, @delete(gcf), true);
Full code below:
classdef RawDataPlotterNew < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
RawdataPlotterAppUIFigure matlab.ui.Figure
GridLayout matlab.ui.container.GridLayout
LeftPanel matlab.ui.container.Panel
ControlPanel matlab.ui.container.Panel
SelectDataFileButton matlab.ui.control.Button
QuitButton matlab.ui.control.Button
ChannelSelectPanel matlab.ui.container.Panel
Select355CheckBox matlab.ui.control.CheckBox
Select532CheckBox matlab.ui.control.CheckBox
Select1064CheckBox matlab.ui.control.CheckBox
DelaysEditField matlab.ui.control.NumericEditField
DelaysEditFieldLabel matlab.ui.control.Label
StepDownButton matlab.ui.control.Button
AltMaxEditField matlab.ui.control.NumericEditField
AltMaxEditFieldLabel matlab.ui.control.Label
AltMinEditField matlab.ui.control.NumericEditField
AltMinEditFieldLabel matlab.ui.control.Label
CountsMaxEditField matlab.ui.control.NumericEditField
CountsMaxEditFieldLabel matlab.ui.control.Label
CountsMinEditField matlab.ui.control.NumericEditField
CountsMinEditFieldLabel matlab.ui.control.Label
AutoScaleYCheckBox matlab.ui.control.CheckBox
AutoScaleXCheckBox matlab.ui.control.CheckBox
LegendCheckBox matlab.ui.control.CheckBox
LogScaleCheckBox matlab.ui.control.CheckBox
RangeSquaredCheckBox matlab.ui.control.CheckBox
RunButton matlab.ui.control.StateButton
StepUpButton matlab.ui.control.Button
RecordEditField matlab.ui.control.NumericEditField
RecordEditFieldLabel matlab.ui.control.Label
TimeEditField matlab.ui.control.NumericEditField
TimeEditFieldLabel matlab.ui.control.Label
Channel4DropDown matlab.ui.control.DropDown
Channel4DropDownLabel matlab.ui.control.Label
Channel3DropDown matlab.ui.control.DropDown
Channel3DropDownLabel matlab.ui.control.Label
Channel2DropDown matlab.ui.control.DropDown
Channel2DropDownLabel matlab.ui.control.Label
Channel1DropDown matlab.ui.control.DropDown
Channel1DropDownLabel matlab.ui.control.Label
RightPanel matlab.ui.container.Panel
Panel4 matlab.ui.container.Panel
StatusEditField matlab.ui.control.EditField
StatusEditFieldLabel matlab.ui.control.Label
PathnameEditField matlab.ui.control.EditField
PathnameEditFieldLabel matlab.ui.control.Label
FilenameEditField matlab.ui.control.EditField
FilenameEditFieldLabel matlab.ui.control.Label
Panel3 matlab.ui.container.Panel
UIAxes matlab.ui.control.UIAxes
end
% Properties that correspond to apps with auto-reflow
properties (Access = private)
onePanelWidth = 576;
end
properties (Access = private)
FileName; % File for rawdata file being plotted
PathName; % Path for rawdata file being plotted
FullFileName; %Full filename
ChannelNames; %Names of the channels in data file
Altitude; %Altitude from raw data file
TimeUT; %time from rawdata file
SelectedChannels; %array of selected channels
CurrentRecord; %record index
CurrentTimeUT; %current time of data record
data; % data from selected channels
range; % range data for all PMT channels
range50; % range data for all APD channels
NumChannels = 4;
goodFileSelected = 0; %toggle to make sure a good file is selected
end
methods (Access = private)
function updatePlot(app)
getSelectedChannels(app)
for idx=1:app.NumChannels
if app.RangeSquaredCheckBox.Value
x = squeeze(app.data(:,app.CurrentRecord,idx));
else
if contains(app.SelectedChannels(idx),’1064′)
x = squeeze(app.data(:,app.CurrentRecord,idx))./(app.range50(:,app.CurrentRecord)).^2;
else
x = squeeze(app.data(:,app.CurrentRecord,idx))./(app.range(:,app.CurrentRecord)).^2;
end
end
plot(app.UIAxes,x,app.Altitude);
hold(app.UIAxes,’on’)
end
hold(app.UIAxes,’off’)
%scale axes
if app.AutoScaleXCheckBox.Value
xlim(app.UIAxes,[0,2^16]);
else
xlim(app.UIAxes, [app.CountsMinEditField.Value,app.CountsMaxEditField.Value]);
end
if app.AutoScaleYCheckBox.Value
ylim(app.UIAxes, [min(app.Altitude),max(app.Altitude)]);
else
ylim(app.UIAxes, [app.AltMinEditField.Value,app.AltMaxEditField.Value]);
end
%check log scale
if app.LogScaleCheckBox.Value == 1
xscale(app.UIAxes,"log");
else
xscale(app.UIAxes,"linear");
end
%add legend
if app.LegendCheckBox.Value
legend(app.UIAxes,app.SelectedChannels,’Interpreter’, ‘none’)
else
legend(app.UIAxes,’off’)
end
drawnow;
end
function getSelectedChannels(app)
channel(1) = app.Channel1DropDown.ValueIndex;
channel(2) = app.Channel2DropDown.ValueIndex;
channel(3) = app.Channel3DropDown.ValueIndex;
channel(4) = app.Channel4DropDown.ValueIndex;
for idx=1:app.NumChannels
app.SelectedChannels{idx} = app.ChannelNames{channel(idx)};
end
end
function updateData(app)
if app.goodFileSelected
%always update selected channels
getSelectedChannels(app);
for idx=1:app.NumChannels
if contains(app.SelectedChannels{idx},’None’)
app.data(:,:,idx) = NaN(size(app.Altitude,1),size(app.TimeUT,2));
else
dataName = [‘/CLDSData/’,app.SelectedChannels{idx}];
app.data(:,:,idx) = h5read(app.FullFileName,dataName);
end
end
else
app.StatusEditField.Value = ‘Not correct type of data file (LBW or HBW)’;
end
end
function updateDataSingleChannel(app,idx)
if app.goodFileSelected
%always update selected channels
getSelectedChannels(app);
if contains(app.SelectedChannels{idx},’None’)
app.data(:,:,idx) = NaN(size(app.Altitude,1),size(app.TimeUT,2));
else
dataName = [‘/CLDSData/’,app.SelectedChannels{idx}];
app.data(:,:,idx) = h5read(app.FullFileName,dataName);
end
else
app.StatusEditField.Value = ‘Not correct type of data file (LBW or HBW)’;
end
end
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
SelectDataFileButtonPushed(app, [])
end
% Button pushed function: QuitButton
function QuitButtonPushed(app, event)
delete(app)
end
% Button pushed function: SelectDataFileButton
function SelectDataFileButtonPushed(app, event)
defname = ‘/Users/Shared/Data/’;
[app.FileName,app.PathName] = uigetfile(‘.h5′,’Select H5 File’,defname);
app.FilenameEditField.Value = app.FileName;
app.PathnameEditField.Value = app.PathName;
app.FullFileName = fullfile(app.PathName,app.FileName);
%get channel names and populate the dropdown lists
%do try catch to see if data file is correct
try
app.ChannelNames = h5read(app.FullFileName,’/Channel_Names’);
selectIdx = contains(app.ChannelNames,’high’);
app.ChannelNames = app.ChannelNames(selectIdx);
app.ChannelNames = [{‘None’};app.ChannelNames];
app.Channel1DropDown.Items = app.ChannelNames;
app.Channel2DropDown.Items = app.ChannelNames;
app.Channel3DropDown.Items = app.ChannelNames;
app.Channel4DropDown.Items = app.ChannelNames;
catch
app.StatusEditField.Value = ‘Not correct type of data file (LBW or HBW)’;
end
%load in the altitude and time data
try
app.Altitude = h5read(app.FullFileName,’/DataProducts/Altitude’)/1000;
app.TimeUT = h5read(app.FullFileName,’/Nav_Data/gps_time’);
app.CurrentRecord = 1;
app.CurrentTimeUT = app.TimeUT(app.CurrentRecord);
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
app.RecordEditField.Value = app.CurrentRecord;
app.goodFileSelected = 1;
catch
app.StatusEditField.Value = ‘Issue reading altitude or time from data file’;
end
%get range data
app.range = h5read(app.FullFileName,’/UserInput/range_interp’);
app.range50 = h5read(app.FullFileName,’/UserInput/range50_interp’);
%initialize data array to NaN
app.data = NaN(size(app.Altitude,1),size(app.TimeUT,2),app.NumChannels);
%set limits on record and time values
app.RecordEditField.Limits = [1,size(app.TimeUT,2)];
app.TimeEditField.Limits = [min(app.TimeUT),max(app.TimeUT)];
%update data
updateData(app);
%plot data
updatePlot(app);
end
% Value changed function: RecordEditField
function RecordEditFieldValueChanged(app, event)
value = app.RecordEditField.Value;
app.CurrentRecord = value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
updatePlot(app)
end
% Value changed function: TimeEditField
function TimeEditFieldValueChanged(app, event)
value = app.TimeEditField.Value;
if value <= app.TimeUT(1,end)
idx = find(app.TimeUT>=value,1,’first’);
else
idx = size(app.TimeUT,2);
end
app.CurrentTimeUT = app.TimeUT(idx);
app.RecordValue.Value = idx;
updatePlot(app)
end
% Value changed function: Channel1DropDown
function Channel1DropDownValueChanged(app, event)
updateDataSingleChannel(app,1);
updatePlot(app);
end
% Value changed function: Channel2DropDown
function Channel2DropDownValueChanged(app, event)
updateDataSingleChannel(app,2);
updatePlot(app);
end
% Value changed function: Channel3DropDown
function Channel3DropDownValueChanged(app, event)
updateDataSingleChannel(app,3);
updatePlot(app);
end
% Value changed function: Channel4DropDown
function Channel4DropDownValueChanged(app, event)
updateDataSingleChannel(app,4);
updatePlot(app);
end
% Value changed function: LogScaleCheckBox
function LogScaleCheckBoxValueChanged(app, event)
updatePlot(app);
end
% Value changed function: LegendCheckBox
function LegendCheckBoxValueChanged(app, event)
updatePlot(app);
end
% Value changed function: CountsMaxEditField
function CountsMaxEditFieldValueChanged(app, event)
updatePlot(app)
end
% Value changed function: CountsMinEditField
function CountsMinEditFieldValueChanged(app, event)
updatePlot(app)
end
% Value changed function: AltMinEditField
function AltMinEditFieldValueChanged(app, event)
updatePlot(app)
end
% Value changed function: AltMaxEditField
function AltMaxEditFieldValueChanged(app, event)
updatePlot(app)
end
% Button pushed function: StepUpButton
function StepUpButtonPushed(app, event)
app.RecordEditField.Value = app.RecordEditField.Value+1;
app.CurrentRecord = app.RecordEditField.Value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
updatePlot(app)
end
% Button pushed function: StepDownButton
function StepDownButtonPushed(app, event)
app.RecordEditField.Value = app.RecordEditField.Value-1;
app.CurrentRecord = app.RecordEditField.Value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
updatePlot(app)
end
% Value changed function: RunButton
function RunButtonValueChanged(app, event)
value = app.RunButton.Value;
while value == 1
app.RunButton.Text = ‘Stop’;
app.RunButton.BackgroundColor = [1,0,0];
app.RecordEditField.Value = app.RecordEditField.Value+1;
app.CurrentRecord = app.RecordEditField.Value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
pause(app.DelaysEditField.Value)
updatePlot(app)
value = app.RunButton.Value;
end
app.RunButton.Text = ‘Run’;
app.RunButton.BackgroundColor = [0.96,0.96,0.96];
end
% Value changed function: Select1064CheckBox
function Select1064CheckBoxValueChanged(app, event)
%uncheck other wavelengths (only one possible)
app.Select532CheckBox.Value = 0;
app.Select355CheckBox.Value = 0;
%set dropdown lists for 1064
app.Channel1DropDown.ValueIndex = 2;
app.Channel2DropDown.ValueIndex = 3;
app.Channel3DropDown.ValueIndex = 1;
app.Channel4DropDown.ValueIndex = 1;
updateData(app);
updatePlot(app)
end
% Value changed function: Select532CheckBox
function Select532CheckBoxValueChanged(app, event)
%uncheck other wavelengths (only one possible)
app.Select1064CheckBox.Value = 0;
app.Select355CheckBox.Value = 0;
%set dropdown lists for 1064
app.Channel1DropDown.ValueIndex = 4;
app.Channel2DropDown.ValueIndex = 5;
app.Channel3DropDown.ValueIndex = 6;
app.Channel4DropDown.ValueIndex = 1;
updateData(app);
updatePlot(app);
end
% Value changed function: Select355CheckBox
function Select355CheckBoxValueChanged(app, event)
%uncheck other wavelengths (only one possible)
app.Select1064CheckBox.Value = 0;
app.Select532CheckBox.Value = 0;
%set dropdown lists for 1064
app.Channel1DropDown.ValueIndex = 7;
app.Channel2DropDown.ValueIndex = 8;
app.Channel3DropDown.ValueIndex = 9;
app.Channel4DropDown.ValueIndex = 10;
updateData(app);
updatePlot(app);
end
% Value changed function: DelaysEditField
function DelaysEditFieldValueChanged(app, event)
value = app.DelaysEditField.Value;
if value < 0.05
app.DelaysEditField.Value = 0.05;
end
end
% Changes arrangement of the app based on UIFigure width
function updateAppLayout(app, event)
currentFigureWidth = app.RawdataPlotterAppUIFigure.Position(3);
if(currentFigureWidth <= app.onePanelWidth)
% Change to a 2×1 grid
app.GridLayout.RowHeight = {642, 642};
app.GridLayout.ColumnWidth = {‘1x’};
app.RightPanel.Layout.Row = 2;
app.RightPanel.Layout.Column = 1;
else
% Change to a 1×2 grid
app.GridLayout.RowHeight = {‘1x’};
app.GridLayout.ColumnWidth = {220, ‘1x’};
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
end
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create RawdataPlotterAppUIFigure and hide until all components are created
app.RawdataPlotterAppUIFigure = uifigure(‘Visible’, ‘off’);
app.RawdataPlotterAppUIFigure.AutoResizeChildren = ‘off’;
app.RawdataPlotterAppUIFigure.Position = [100 100 719 642];
app.RawdataPlotterAppUIFigure.Name = ‘Rawdata Plotter App’;
app.RawdataPlotterAppUIFigure.CloseRequestFcn = createCallbackFcn(app, @delete(gcf), true); %MARKED
app.RawdataPlotterAppUIFigure.SizeChangedFcn = createCallbackFcn(app, @updateAppLayout, true);
% Create GridLayout
app.GridLayout = uigridlayout(app.RawdataPlotterAppUIFigure);
app.GridLayout.ColumnWidth = {220, ‘1x’};
app.GridLayout.RowHeight = {‘1x’};
app.GridLayout.ColumnSpacing = 0;
app.GridLayout.RowSpacing = 0;
app.GridLayout.Padding = [0 0 0 0];
app.GridLayout.Scrollable = ‘on’;
% Create LeftPanel
app.LeftPanel = uipanel(app.GridLayout);
app.LeftPanel.Layout.Row = 1;
app.LeftPanel.Layout.Column = 1;
% Create ChannelSelectPanel
app.ChannelSelectPanel = uipanel(app.LeftPanel);
app.ChannelSelectPanel.Title = ‘Channel Select’;
app.ChannelSelectPanel.Position = [9 132 203 502];
% Create Channel1DropDownLabel
app.Channel1DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel1DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel1DropDownLabel.Position = [19 446 59 22];
app.Channel1DropDownLabel.Text = ‘Channel 1’;
% Create Channel1DropDown
app.Channel1DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel1DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel1DropDownValueChanged, true);
app.Channel1DropDown.Position = [93 446 100 22];
% Create Channel2DropDownLabel
app.Channel2DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel2DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel2DropDownLabel.Position = [19 412 59 22];
app.Channel2DropDownLabel.Text = ‘Channel 2’;
% Create Channel2DropDown
app.Channel2DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel2DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel2DropDownValueChanged, true);
app.Channel2DropDown.Position = [93 412 100 22];
% Create Channel3DropDownLabel
app.Channel3DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel3DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel3DropDownLabel.Position = [19 378 59 22];
app.Channel3DropDownLabel.Text = ‘Channel 3’;
% Create Channel3DropDown
app.Channel3DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel3DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel3DropDownValueChanged, true);
app.Channel3DropDown.Position = [93 378 100 22];
% Create Channel4DropDownLabel
app.Channel4DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel4DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel4DropDownLabel.Position = [19 345 59 22];
app.Channel4DropDownLabel.Text = ‘Channel 4’;
% Create Channel4DropDown
app.Channel4DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel4DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel4DropDownValueChanged, true);
app.Channel4DropDown.Position = [93 345 100 22];
% Create TimeEditFieldLabel
app.TimeEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.TimeEditFieldLabel.HorizontalAlignment = ‘right’;
app.TimeEditFieldLabel.Position = [36 210 31 22];
app.TimeEditFieldLabel.Text = ‘Time’;
% Create TimeEditField
app.TimeEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.TimeEditField.ValueDisplayFormat = ‘%11.6g’;
app.TimeEditField.ValueChangedFcn = createCallbackFcn(app, @TimeEditFieldValueChanged, true);
app.TimeEditField.Position = [77 210 100 22];
% Create RecordEditFieldLabel
app.RecordEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.RecordEditFieldLabel.HorizontalAlignment = ‘right’;
app.RecordEditFieldLabel.Position = [25 185 44 22];
app.RecordEditFieldLabel.Text = ‘Record’;
% Create RecordEditField
app.RecordEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.RecordEditField.ValueChangedFcn = createCallbackFcn(app, @RecordEditFieldValueChanged, true);
app.RecordEditField.Position = [77 185 100 22];
% Create StepUpButton
app.StepUpButton = uibutton(app.ChannelSelectPanel, ‘push’);
app.StepUpButton.ButtonPushedFcn = createCallbackFcn(app, @StepUpButtonPushed, true);
app.StepUpButton.Position = [109 154 66 23];
app.StepUpButton.Text = ‘Step Up’;
% Create RunButton
app.RunButton = uibutton(app.ChannelSelectPanel, ‘state’);
app.RunButton.ValueChangedFcn = createCallbackFcn(app, @RunButtonValueChanged, true);
app.RunButton.Text = ‘Run’;
app.RunButton.Position = [57 8 60 23];
% Create RangeSquaredCheckBox
app.RangeSquaredCheckBox = uicheckbox(app.ChannelSelectPanel);
app.RangeSquaredCheckBox.Text = ‘Range Squared’;
app.RangeSquaredCheckBox.Position = [9 82 105 22];
% Create LogScaleCheckBox
app.LogScaleCheckBox = uicheckbox(app.ChannelSelectPanel);
app.LogScaleCheckBox.ValueChangedFcn = createCallbackFcn(app, @LogScaleCheckBoxValueChanged, true);
app.LogScaleCheckBox.Text = ‘Log Scale’;
app.LogScaleCheckBox.Position = [9 61 76 22];
app.LogScaleCheckBox.Value = true;
% Create LegendCheckBox
app.LegendCheckBox = uicheckbox(app.ChannelSelectPanel);
app.LegendCheckBox.ValueChangedFcn = createCallbackFcn(app, @LegendCheckBoxValueChanged, true);
app.LegendCheckBox.Text = ‘Legend’;
app.LegendCheckBox.Position = [9 40 62 22];
app.LegendCheckBox.Value = true;
% Create AutoScaleXCheckBox
app.AutoScaleXCheckBox = uicheckbox(app.ChannelSelectPanel);
app.AutoScaleXCheckBox.Text = ‘Auto Scale X’;
app.AutoScaleXCheckBox.Position = [9 123 91 22];
app.AutoScaleXCheckBox.Value = true;
% Create AutoScaleYCheckBox
app.AutoScaleYCheckBox = uicheckbox(app.ChannelSelectPanel);
app.AutoScaleYCheckBox.Text = ‘Auto Scale Y’;
app.AutoScaleYCheckBox.Position = [9 103 91 22];
app.AutoScaleYCheckBox.Value = true;
% Create CountsMinEditFieldLabel
app.CountsMinEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.CountsMinEditFieldLabel.HorizontalAlignment = ‘right’;
app.CountsMinEditFieldLabel.Position = [22 308 67 22];
app.CountsMinEditFieldLabel.Text = ‘Counts Min’;
% Create CountsMinEditField
app.CountsMinEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.CountsMinEditField.ValueChangedFcn = createCallbackFcn(app, @CountsMinEditFieldValueChanged, true);
app.CountsMinEditField.Position = [25 288 66 22];
app.CountsMinEditField.Value = 0.1;
% Create CountsMaxEditFieldLabel
app.CountsMaxEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.CountsMaxEditFieldLabel.HorizontalAlignment = ‘right’;
app.CountsMaxEditFieldLabel.Position = [104 308 70 22];
app.CountsMaxEditFieldLabel.Text = ‘Counts Max’;
% Create CountsMaxEditField
app.CountsMaxEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.CountsMaxEditField.ValueChangedFcn = createCallbackFcn(app, @CountsMaxEditFieldValueChanged, true);
app.CountsMaxEditField.Position = [104 288 70 22];
app.CountsMaxEditField.Value = 65536;
% Create AltMinEditFieldLabel
app.AltMinEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.AltMinEditFieldLabel.HorizontalAlignment = ‘right’;
app.AltMinEditFieldLabel.Position = [36 267 42 22];
app.AltMinEditFieldLabel.Text = ‘Alt Min’;
% Create AltMinEditField
app.AltMinEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.AltMinEditField.ValueChangedFcn = createCallbackFcn(app, @AltMinEditFieldValueChanged, true);
app.AltMinEditField.Position = [25 246 66 22];
app.AltMinEditField.Value = -500;
% Create AltMaxEditFieldLabel
app.AltMaxEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.AltMaxEditFieldLabel.HorizontalAlignment = ‘right’;
app.AltMaxEditFieldLabel.Position = [114 267 46 22];
app.AltMaxEditFieldLabel.Text = ‘Alt Max’;
% Create AltMaxEditField
app.AltMaxEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.AltMaxEditField.ValueChangedFcn = createCallbackFcn(app, @AltMaxEditFieldValueChanged, true);
app.AltMaxEditField.Position = [104 246 69 22];
app.AltMaxEditField.Value = 22000;
% Create StepDownButton
app.StepDownButton = uibutton(app.ChannelSelectPanel, ‘push’);
app.StepDownButton.ButtonPushedFcn = createCallbackFcn(app, @StepDownButtonPushed, true);
app.StepDownButton.Position = [24 154 75 23];
app.StepDownButton.Text = ‘Step Down’;
% Create DelaysEditFieldLabel
app.DelaysEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.DelaysEditFieldLabel.HorizontalAlignment = ‘right’;
app.DelaysEditFieldLabel.Position = [119 34 51 22];
app.DelaysEditFieldLabel.Text = ‘Delay (s)’;
% Create DelaysEditField
app.DelaysEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.DelaysEditField.ValueChangedFcn = createCallbackFcn(app, @DelaysEditFieldValueChanged, true);
app.DelaysEditField.Position = [128 9 34 22];
app.DelaysEditField.Value = 1;
% Create Select1064CheckBox
app.Select1064CheckBox = uicheckbox(app.ChannelSelectPanel);
app.Select1064CheckBox.ValueChangedFcn = createCallbackFcn(app, @Select1064CheckBoxValueChanged, true);
app.Select1064CheckBox.Text = ‘Select 1064’;
app.Select1064CheckBox.Position = [119 124 86 22];
% Create Select532CheckBox
app.Select532CheckBox = uicheckbox(app.ChannelSelectPanel);
app.Select532CheckBox.ValueChangedFcn = createCallbackFcn(app, @Select532CheckBoxValueChanged, true);
app.Select532CheckBox.Text = ‘Select 532’;
app.Select532CheckBox.Position = [119 101 79 22];
% Create Select355CheckBox
app.Select355CheckBox = uicheckbox(app.ChannelSelectPanel);
app.Select355CheckBox.ValueChangedFcn = createCallbackFcn(app, @Select355CheckBoxValueChanged, true);
app.Select355CheckBox.Text = ‘Select 355’;
app.Select355CheckBox.Position = [119 79 79 22];
% Create ControlPanel
app.ControlPanel = uipanel(app.LeftPanel);
app.ControlPanel.Title = ‘Control’;
app.ControlPanel.Position = [9 13 203 110];
% Create QuitButton
app.QuitButton = uibutton(app.ControlPanel, ‘push’);
app.QuitButton.ButtonPushedFcn = createCallbackFcn(app, @QuitButtonPushed, true);
app.QuitButton.FontWeight = ‘bold’;
app.QuitButton.FontColor = [1 0 0];
app.QuitButton.Position = [57 12 100 23];
app.QuitButton.Text = ‘Quit’;
% Create SelectDataFileButton
app.SelectDataFileButton = uibutton(app.ControlPanel, ‘push’);
app.SelectDataFileButton.ButtonPushedFcn = createCallbackFcn(app, @SelectDataFileButtonPushed, true);
app.SelectDataFileButton.Position = [57 54 100 23];
app.SelectDataFileButton.Text = ‘Select Data File’;
% Create RightPanel
app.RightPanel = uipanel(app.GridLayout);
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
% Create Panel3
app.Panel3 = uipanel(app.RightPanel);
app.Panel3.Title = ‘Panel3’;
app.Panel3.Position = [9 142 481 493];
% Create UIAxes
app.UIAxes = uiaxes(app.Panel3);
xlabel(app.UIAxes, ‘Counts’)
ylabel(app.UIAxes, ‘Altitude (km)’)
zlabel(app.UIAxes, ‘Z’)
app.UIAxes.GridLineWidth = 0.5;
app.UIAxes.MinorGridLineWidth = 0.5;
app.UIAxes.LineWidth = 0.5;
app.UIAxes.Box = ‘off’;
app.UIAxes.FontSize = 14;
app.UIAxes.Position = [4 0 475 469];
% Create Panel4
app.Panel4 = uipanel(app.RightPanel);
app.Panel4.Title = ‘Panel4’;
app.Panel4.Position = [9 10 479 123];
% Create FilenameEditFieldLabel
app.FilenameEditFieldLabel = uilabel(app.Panel4);
app.FilenameEditFieldLabel.HorizontalAlignment = ‘right’;
app.FilenameEditFieldLabel.Position = [14 75 53 22];
app.FilenameEditFieldLabel.Text = ‘Filename’;
% Create FilenameEditField
app.FilenameEditField = uieditfield(app.Panel4, ‘text’);
app.FilenameEditField.Position = [82 75 388 22];
% Create PathnameEditFieldLabel
app.PathnameEditFieldLabel = uilabel(app.Panel4);
app.PathnameEditFieldLabel.HorizontalAlignment = ‘right’;
app.PathnameEditFieldLabel.Position = [8 47 59 22];
app.PathnameEditFieldLabel.Text = ‘Pathname’;
% Create PathnameEditField
app.PathnameEditField = uieditfield(app.Panel4, ‘text’);
app.PathnameEditField.Position = [82 47 388 22];
% Create StatusEditFieldLabel
app.StatusEditFieldLabel = uilabel(app.Panel4);
app.StatusEditFieldLabel.HorizontalAlignment = ‘right’;
app.StatusEditFieldLabel.Position = [28 19 39 22];
app.StatusEditFieldLabel.Text = ‘Status’;
% Create StatusEditField
app.StatusEditField = uieditfield(app.Panel4, ‘text’);
app.StatusEditField.Position = [82 19 388 22];
% Show the figure after all components are created
app.RawdataPlotterAppUIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = RawDataPlotterNew
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.RawdataPlotterAppUIFigure)
% 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.RawdataPlotterAppUIFigure)
end
end
end App designer places code (grayed out) that shows an error. I will note that the code ran fine before I saved and closed it out and then later restarted the app. I think the issue might be related to the fact that I had a callback that used the delete function which is used to close the app.
The line that show the syntax error is the following and bold in the full code listing:
app.RawdataPlotterAppUIFigure.CloseRequestFcn = createCallbackFcn(app, @delete(gcf), true);
Full code below:
classdef RawDataPlotterNew < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
RawdataPlotterAppUIFigure matlab.ui.Figure
GridLayout matlab.ui.container.GridLayout
LeftPanel matlab.ui.container.Panel
ControlPanel matlab.ui.container.Panel
SelectDataFileButton matlab.ui.control.Button
QuitButton matlab.ui.control.Button
ChannelSelectPanel matlab.ui.container.Panel
Select355CheckBox matlab.ui.control.CheckBox
Select532CheckBox matlab.ui.control.CheckBox
Select1064CheckBox matlab.ui.control.CheckBox
DelaysEditField matlab.ui.control.NumericEditField
DelaysEditFieldLabel matlab.ui.control.Label
StepDownButton matlab.ui.control.Button
AltMaxEditField matlab.ui.control.NumericEditField
AltMaxEditFieldLabel matlab.ui.control.Label
AltMinEditField matlab.ui.control.NumericEditField
AltMinEditFieldLabel matlab.ui.control.Label
CountsMaxEditField matlab.ui.control.NumericEditField
CountsMaxEditFieldLabel matlab.ui.control.Label
CountsMinEditField matlab.ui.control.NumericEditField
CountsMinEditFieldLabel matlab.ui.control.Label
AutoScaleYCheckBox matlab.ui.control.CheckBox
AutoScaleXCheckBox matlab.ui.control.CheckBox
LegendCheckBox matlab.ui.control.CheckBox
LogScaleCheckBox matlab.ui.control.CheckBox
RangeSquaredCheckBox matlab.ui.control.CheckBox
RunButton matlab.ui.control.StateButton
StepUpButton matlab.ui.control.Button
RecordEditField matlab.ui.control.NumericEditField
RecordEditFieldLabel matlab.ui.control.Label
TimeEditField matlab.ui.control.NumericEditField
TimeEditFieldLabel matlab.ui.control.Label
Channel4DropDown matlab.ui.control.DropDown
Channel4DropDownLabel matlab.ui.control.Label
Channel3DropDown matlab.ui.control.DropDown
Channel3DropDownLabel matlab.ui.control.Label
Channel2DropDown matlab.ui.control.DropDown
Channel2DropDownLabel matlab.ui.control.Label
Channel1DropDown matlab.ui.control.DropDown
Channel1DropDownLabel matlab.ui.control.Label
RightPanel matlab.ui.container.Panel
Panel4 matlab.ui.container.Panel
StatusEditField matlab.ui.control.EditField
StatusEditFieldLabel matlab.ui.control.Label
PathnameEditField matlab.ui.control.EditField
PathnameEditFieldLabel matlab.ui.control.Label
FilenameEditField matlab.ui.control.EditField
FilenameEditFieldLabel matlab.ui.control.Label
Panel3 matlab.ui.container.Panel
UIAxes matlab.ui.control.UIAxes
end
% Properties that correspond to apps with auto-reflow
properties (Access = private)
onePanelWidth = 576;
end
properties (Access = private)
FileName; % File for rawdata file being plotted
PathName; % Path for rawdata file being plotted
FullFileName; %Full filename
ChannelNames; %Names of the channels in data file
Altitude; %Altitude from raw data file
TimeUT; %time from rawdata file
SelectedChannels; %array of selected channels
CurrentRecord; %record index
CurrentTimeUT; %current time of data record
data; % data from selected channels
range; % range data for all PMT channels
range50; % range data for all APD channels
NumChannels = 4;
goodFileSelected = 0; %toggle to make sure a good file is selected
end
methods (Access = private)
function updatePlot(app)
getSelectedChannels(app)
for idx=1:app.NumChannels
if app.RangeSquaredCheckBox.Value
x = squeeze(app.data(:,app.CurrentRecord,idx));
else
if contains(app.SelectedChannels(idx),’1064′)
x = squeeze(app.data(:,app.CurrentRecord,idx))./(app.range50(:,app.CurrentRecord)).^2;
else
x = squeeze(app.data(:,app.CurrentRecord,idx))./(app.range(:,app.CurrentRecord)).^2;
end
end
plot(app.UIAxes,x,app.Altitude);
hold(app.UIAxes,’on’)
end
hold(app.UIAxes,’off’)
%scale axes
if app.AutoScaleXCheckBox.Value
xlim(app.UIAxes,[0,2^16]);
else
xlim(app.UIAxes, [app.CountsMinEditField.Value,app.CountsMaxEditField.Value]);
end
if app.AutoScaleYCheckBox.Value
ylim(app.UIAxes, [min(app.Altitude),max(app.Altitude)]);
else
ylim(app.UIAxes, [app.AltMinEditField.Value,app.AltMaxEditField.Value]);
end
%check log scale
if app.LogScaleCheckBox.Value == 1
xscale(app.UIAxes,"log");
else
xscale(app.UIAxes,"linear");
end
%add legend
if app.LegendCheckBox.Value
legend(app.UIAxes,app.SelectedChannels,’Interpreter’, ‘none’)
else
legend(app.UIAxes,’off’)
end
drawnow;
end
function getSelectedChannels(app)
channel(1) = app.Channel1DropDown.ValueIndex;
channel(2) = app.Channel2DropDown.ValueIndex;
channel(3) = app.Channel3DropDown.ValueIndex;
channel(4) = app.Channel4DropDown.ValueIndex;
for idx=1:app.NumChannels
app.SelectedChannels{idx} = app.ChannelNames{channel(idx)};
end
end
function updateData(app)
if app.goodFileSelected
%always update selected channels
getSelectedChannels(app);
for idx=1:app.NumChannels
if contains(app.SelectedChannels{idx},’None’)
app.data(:,:,idx) = NaN(size(app.Altitude,1),size(app.TimeUT,2));
else
dataName = [‘/CLDSData/’,app.SelectedChannels{idx}];
app.data(:,:,idx) = h5read(app.FullFileName,dataName);
end
end
else
app.StatusEditField.Value = ‘Not correct type of data file (LBW or HBW)’;
end
end
function updateDataSingleChannel(app,idx)
if app.goodFileSelected
%always update selected channels
getSelectedChannels(app);
if contains(app.SelectedChannels{idx},’None’)
app.data(:,:,idx) = NaN(size(app.Altitude,1),size(app.TimeUT,2));
else
dataName = [‘/CLDSData/’,app.SelectedChannels{idx}];
app.data(:,:,idx) = h5read(app.FullFileName,dataName);
end
else
app.StatusEditField.Value = ‘Not correct type of data file (LBW or HBW)’;
end
end
end
% Callbacks that handle component events
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
SelectDataFileButtonPushed(app, [])
end
% Button pushed function: QuitButton
function QuitButtonPushed(app, event)
delete(app)
end
% Button pushed function: SelectDataFileButton
function SelectDataFileButtonPushed(app, event)
defname = ‘/Users/Shared/Data/’;
[app.FileName,app.PathName] = uigetfile(‘.h5′,’Select H5 File’,defname);
app.FilenameEditField.Value = app.FileName;
app.PathnameEditField.Value = app.PathName;
app.FullFileName = fullfile(app.PathName,app.FileName);
%get channel names and populate the dropdown lists
%do try catch to see if data file is correct
try
app.ChannelNames = h5read(app.FullFileName,’/Channel_Names’);
selectIdx = contains(app.ChannelNames,’high’);
app.ChannelNames = app.ChannelNames(selectIdx);
app.ChannelNames = [{‘None’};app.ChannelNames];
app.Channel1DropDown.Items = app.ChannelNames;
app.Channel2DropDown.Items = app.ChannelNames;
app.Channel3DropDown.Items = app.ChannelNames;
app.Channel4DropDown.Items = app.ChannelNames;
catch
app.StatusEditField.Value = ‘Not correct type of data file (LBW or HBW)’;
end
%load in the altitude and time data
try
app.Altitude = h5read(app.FullFileName,’/DataProducts/Altitude’)/1000;
app.TimeUT = h5read(app.FullFileName,’/Nav_Data/gps_time’);
app.CurrentRecord = 1;
app.CurrentTimeUT = app.TimeUT(app.CurrentRecord);
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
app.RecordEditField.Value = app.CurrentRecord;
app.goodFileSelected = 1;
catch
app.StatusEditField.Value = ‘Issue reading altitude or time from data file’;
end
%get range data
app.range = h5read(app.FullFileName,’/UserInput/range_interp’);
app.range50 = h5read(app.FullFileName,’/UserInput/range50_interp’);
%initialize data array to NaN
app.data = NaN(size(app.Altitude,1),size(app.TimeUT,2),app.NumChannels);
%set limits on record and time values
app.RecordEditField.Limits = [1,size(app.TimeUT,2)];
app.TimeEditField.Limits = [min(app.TimeUT),max(app.TimeUT)];
%update data
updateData(app);
%plot data
updatePlot(app);
end
% Value changed function: RecordEditField
function RecordEditFieldValueChanged(app, event)
value = app.RecordEditField.Value;
app.CurrentRecord = value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
updatePlot(app)
end
% Value changed function: TimeEditField
function TimeEditFieldValueChanged(app, event)
value = app.TimeEditField.Value;
if value <= app.TimeUT(1,end)
idx = find(app.TimeUT>=value,1,’first’);
else
idx = size(app.TimeUT,2);
end
app.CurrentTimeUT = app.TimeUT(idx);
app.RecordValue.Value = idx;
updatePlot(app)
end
% Value changed function: Channel1DropDown
function Channel1DropDownValueChanged(app, event)
updateDataSingleChannel(app,1);
updatePlot(app);
end
% Value changed function: Channel2DropDown
function Channel2DropDownValueChanged(app, event)
updateDataSingleChannel(app,2);
updatePlot(app);
end
% Value changed function: Channel3DropDown
function Channel3DropDownValueChanged(app, event)
updateDataSingleChannel(app,3);
updatePlot(app);
end
% Value changed function: Channel4DropDown
function Channel4DropDownValueChanged(app, event)
updateDataSingleChannel(app,4);
updatePlot(app);
end
% Value changed function: LogScaleCheckBox
function LogScaleCheckBoxValueChanged(app, event)
updatePlot(app);
end
% Value changed function: LegendCheckBox
function LegendCheckBoxValueChanged(app, event)
updatePlot(app);
end
% Value changed function: CountsMaxEditField
function CountsMaxEditFieldValueChanged(app, event)
updatePlot(app)
end
% Value changed function: CountsMinEditField
function CountsMinEditFieldValueChanged(app, event)
updatePlot(app)
end
% Value changed function: AltMinEditField
function AltMinEditFieldValueChanged(app, event)
updatePlot(app)
end
% Value changed function: AltMaxEditField
function AltMaxEditFieldValueChanged(app, event)
updatePlot(app)
end
% Button pushed function: StepUpButton
function StepUpButtonPushed(app, event)
app.RecordEditField.Value = app.RecordEditField.Value+1;
app.CurrentRecord = app.RecordEditField.Value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
updatePlot(app)
end
% Button pushed function: StepDownButton
function StepDownButtonPushed(app, event)
app.RecordEditField.Value = app.RecordEditField.Value-1;
app.CurrentRecord = app.RecordEditField.Value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
updatePlot(app)
end
% Value changed function: RunButton
function RunButtonValueChanged(app, event)
value = app.RunButton.Value;
while value == 1
app.RunButton.Text = ‘Stop’;
app.RunButton.BackgroundColor = [1,0,0];
app.RecordEditField.Value = app.RecordEditField.Value+1;
app.CurrentRecord = app.RecordEditField.Value;
app.TimeEditField.Value = app.TimeUT(app.CurrentRecord);
pause(app.DelaysEditField.Value)
updatePlot(app)
value = app.RunButton.Value;
end
app.RunButton.Text = ‘Run’;
app.RunButton.BackgroundColor = [0.96,0.96,0.96];
end
% Value changed function: Select1064CheckBox
function Select1064CheckBoxValueChanged(app, event)
%uncheck other wavelengths (only one possible)
app.Select532CheckBox.Value = 0;
app.Select355CheckBox.Value = 0;
%set dropdown lists for 1064
app.Channel1DropDown.ValueIndex = 2;
app.Channel2DropDown.ValueIndex = 3;
app.Channel3DropDown.ValueIndex = 1;
app.Channel4DropDown.ValueIndex = 1;
updateData(app);
updatePlot(app)
end
% Value changed function: Select532CheckBox
function Select532CheckBoxValueChanged(app, event)
%uncheck other wavelengths (only one possible)
app.Select1064CheckBox.Value = 0;
app.Select355CheckBox.Value = 0;
%set dropdown lists for 1064
app.Channel1DropDown.ValueIndex = 4;
app.Channel2DropDown.ValueIndex = 5;
app.Channel3DropDown.ValueIndex = 6;
app.Channel4DropDown.ValueIndex = 1;
updateData(app);
updatePlot(app);
end
% Value changed function: Select355CheckBox
function Select355CheckBoxValueChanged(app, event)
%uncheck other wavelengths (only one possible)
app.Select1064CheckBox.Value = 0;
app.Select532CheckBox.Value = 0;
%set dropdown lists for 1064
app.Channel1DropDown.ValueIndex = 7;
app.Channel2DropDown.ValueIndex = 8;
app.Channel3DropDown.ValueIndex = 9;
app.Channel4DropDown.ValueIndex = 10;
updateData(app);
updatePlot(app);
end
% Value changed function: DelaysEditField
function DelaysEditFieldValueChanged(app, event)
value = app.DelaysEditField.Value;
if value < 0.05
app.DelaysEditField.Value = 0.05;
end
end
% Changes arrangement of the app based on UIFigure width
function updateAppLayout(app, event)
currentFigureWidth = app.RawdataPlotterAppUIFigure.Position(3);
if(currentFigureWidth <= app.onePanelWidth)
% Change to a 2×1 grid
app.GridLayout.RowHeight = {642, 642};
app.GridLayout.ColumnWidth = {‘1x’};
app.RightPanel.Layout.Row = 2;
app.RightPanel.Layout.Column = 1;
else
% Change to a 1×2 grid
app.GridLayout.RowHeight = {‘1x’};
app.GridLayout.ColumnWidth = {220, ‘1x’};
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
end
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create RawdataPlotterAppUIFigure and hide until all components are created
app.RawdataPlotterAppUIFigure = uifigure(‘Visible’, ‘off’);
app.RawdataPlotterAppUIFigure.AutoResizeChildren = ‘off’;
app.RawdataPlotterAppUIFigure.Position = [100 100 719 642];
app.RawdataPlotterAppUIFigure.Name = ‘Rawdata Plotter App’;
app.RawdataPlotterAppUIFigure.CloseRequestFcn = createCallbackFcn(app, @delete(gcf), true); %MARKED
app.RawdataPlotterAppUIFigure.SizeChangedFcn = createCallbackFcn(app, @updateAppLayout, true);
% Create GridLayout
app.GridLayout = uigridlayout(app.RawdataPlotterAppUIFigure);
app.GridLayout.ColumnWidth = {220, ‘1x’};
app.GridLayout.RowHeight = {‘1x’};
app.GridLayout.ColumnSpacing = 0;
app.GridLayout.RowSpacing = 0;
app.GridLayout.Padding = [0 0 0 0];
app.GridLayout.Scrollable = ‘on’;
% Create LeftPanel
app.LeftPanel = uipanel(app.GridLayout);
app.LeftPanel.Layout.Row = 1;
app.LeftPanel.Layout.Column = 1;
% Create ChannelSelectPanel
app.ChannelSelectPanel = uipanel(app.LeftPanel);
app.ChannelSelectPanel.Title = ‘Channel Select’;
app.ChannelSelectPanel.Position = [9 132 203 502];
% Create Channel1DropDownLabel
app.Channel1DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel1DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel1DropDownLabel.Position = [19 446 59 22];
app.Channel1DropDownLabel.Text = ‘Channel 1’;
% Create Channel1DropDown
app.Channel1DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel1DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel1DropDownValueChanged, true);
app.Channel1DropDown.Position = [93 446 100 22];
% Create Channel2DropDownLabel
app.Channel2DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel2DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel2DropDownLabel.Position = [19 412 59 22];
app.Channel2DropDownLabel.Text = ‘Channel 2’;
% Create Channel2DropDown
app.Channel2DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel2DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel2DropDownValueChanged, true);
app.Channel2DropDown.Position = [93 412 100 22];
% Create Channel3DropDownLabel
app.Channel3DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel3DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel3DropDownLabel.Position = [19 378 59 22];
app.Channel3DropDownLabel.Text = ‘Channel 3’;
% Create Channel3DropDown
app.Channel3DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel3DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel3DropDownValueChanged, true);
app.Channel3DropDown.Position = [93 378 100 22];
% Create Channel4DropDownLabel
app.Channel4DropDownLabel = uilabel(app.ChannelSelectPanel);
app.Channel4DropDownLabel.HorizontalAlignment = ‘right’;
app.Channel4DropDownLabel.Position = [19 345 59 22];
app.Channel4DropDownLabel.Text = ‘Channel 4’;
% Create Channel4DropDown
app.Channel4DropDown = uidropdown(app.ChannelSelectPanel);
app.Channel4DropDown.ValueChangedFcn = createCallbackFcn(app, @Channel4DropDownValueChanged, true);
app.Channel4DropDown.Position = [93 345 100 22];
% Create TimeEditFieldLabel
app.TimeEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.TimeEditFieldLabel.HorizontalAlignment = ‘right’;
app.TimeEditFieldLabel.Position = [36 210 31 22];
app.TimeEditFieldLabel.Text = ‘Time’;
% Create TimeEditField
app.TimeEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.TimeEditField.ValueDisplayFormat = ‘%11.6g’;
app.TimeEditField.ValueChangedFcn = createCallbackFcn(app, @TimeEditFieldValueChanged, true);
app.TimeEditField.Position = [77 210 100 22];
% Create RecordEditFieldLabel
app.RecordEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.RecordEditFieldLabel.HorizontalAlignment = ‘right’;
app.RecordEditFieldLabel.Position = [25 185 44 22];
app.RecordEditFieldLabel.Text = ‘Record’;
% Create RecordEditField
app.RecordEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.RecordEditField.ValueChangedFcn = createCallbackFcn(app, @RecordEditFieldValueChanged, true);
app.RecordEditField.Position = [77 185 100 22];
% Create StepUpButton
app.StepUpButton = uibutton(app.ChannelSelectPanel, ‘push’);
app.StepUpButton.ButtonPushedFcn = createCallbackFcn(app, @StepUpButtonPushed, true);
app.StepUpButton.Position = [109 154 66 23];
app.StepUpButton.Text = ‘Step Up’;
% Create RunButton
app.RunButton = uibutton(app.ChannelSelectPanel, ‘state’);
app.RunButton.ValueChangedFcn = createCallbackFcn(app, @RunButtonValueChanged, true);
app.RunButton.Text = ‘Run’;
app.RunButton.Position = [57 8 60 23];
% Create RangeSquaredCheckBox
app.RangeSquaredCheckBox = uicheckbox(app.ChannelSelectPanel);
app.RangeSquaredCheckBox.Text = ‘Range Squared’;
app.RangeSquaredCheckBox.Position = [9 82 105 22];
% Create LogScaleCheckBox
app.LogScaleCheckBox = uicheckbox(app.ChannelSelectPanel);
app.LogScaleCheckBox.ValueChangedFcn = createCallbackFcn(app, @LogScaleCheckBoxValueChanged, true);
app.LogScaleCheckBox.Text = ‘Log Scale’;
app.LogScaleCheckBox.Position = [9 61 76 22];
app.LogScaleCheckBox.Value = true;
% Create LegendCheckBox
app.LegendCheckBox = uicheckbox(app.ChannelSelectPanel);
app.LegendCheckBox.ValueChangedFcn = createCallbackFcn(app, @LegendCheckBoxValueChanged, true);
app.LegendCheckBox.Text = ‘Legend’;
app.LegendCheckBox.Position = [9 40 62 22];
app.LegendCheckBox.Value = true;
% Create AutoScaleXCheckBox
app.AutoScaleXCheckBox = uicheckbox(app.ChannelSelectPanel);
app.AutoScaleXCheckBox.Text = ‘Auto Scale X’;
app.AutoScaleXCheckBox.Position = [9 123 91 22];
app.AutoScaleXCheckBox.Value = true;
% Create AutoScaleYCheckBox
app.AutoScaleYCheckBox = uicheckbox(app.ChannelSelectPanel);
app.AutoScaleYCheckBox.Text = ‘Auto Scale Y’;
app.AutoScaleYCheckBox.Position = [9 103 91 22];
app.AutoScaleYCheckBox.Value = true;
% Create CountsMinEditFieldLabel
app.CountsMinEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.CountsMinEditFieldLabel.HorizontalAlignment = ‘right’;
app.CountsMinEditFieldLabel.Position = [22 308 67 22];
app.CountsMinEditFieldLabel.Text = ‘Counts Min’;
% Create CountsMinEditField
app.CountsMinEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.CountsMinEditField.ValueChangedFcn = createCallbackFcn(app, @CountsMinEditFieldValueChanged, true);
app.CountsMinEditField.Position = [25 288 66 22];
app.CountsMinEditField.Value = 0.1;
% Create CountsMaxEditFieldLabel
app.CountsMaxEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.CountsMaxEditFieldLabel.HorizontalAlignment = ‘right’;
app.CountsMaxEditFieldLabel.Position = [104 308 70 22];
app.CountsMaxEditFieldLabel.Text = ‘Counts Max’;
% Create CountsMaxEditField
app.CountsMaxEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.CountsMaxEditField.ValueChangedFcn = createCallbackFcn(app, @CountsMaxEditFieldValueChanged, true);
app.CountsMaxEditField.Position = [104 288 70 22];
app.CountsMaxEditField.Value = 65536;
% Create AltMinEditFieldLabel
app.AltMinEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.AltMinEditFieldLabel.HorizontalAlignment = ‘right’;
app.AltMinEditFieldLabel.Position = [36 267 42 22];
app.AltMinEditFieldLabel.Text = ‘Alt Min’;
% Create AltMinEditField
app.AltMinEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.AltMinEditField.ValueChangedFcn = createCallbackFcn(app, @AltMinEditFieldValueChanged, true);
app.AltMinEditField.Position = [25 246 66 22];
app.AltMinEditField.Value = -500;
% Create AltMaxEditFieldLabel
app.AltMaxEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.AltMaxEditFieldLabel.HorizontalAlignment = ‘right’;
app.AltMaxEditFieldLabel.Position = [114 267 46 22];
app.AltMaxEditFieldLabel.Text = ‘Alt Max’;
% Create AltMaxEditField
app.AltMaxEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.AltMaxEditField.ValueChangedFcn = createCallbackFcn(app, @AltMaxEditFieldValueChanged, true);
app.AltMaxEditField.Position = [104 246 69 22];
app.AltMaxEditField.Value = 22000;
% Create StepDownButton
app.StepDownButton = uibutton(app.ChannelSelectPanel, ‘push’);
app.StepDownButton.ButtonPushedFcn = createCallbackFcn(app, @StepDownButtonPushed, true);
app.StepDownButton.Position = [24 154 75 23];
app.StepDownButton.Text = ‘Step Down’;
% Create DelaysEditFieldLabel
app.DelaysEditFieldLabel = uilabel(app.ChannelSelectPanel);
app.DelaysEditFieldLabel.HorizontalAlignment = ‘right’;
app.DelaysEditFieldLabel.Position = [119 34 51 22];
app.DelaysEditFieldLabel.Text = ‘Delay (s)’;
% Create DelaysEditField
app.DelaysEditField = uieditfield(app.ChannelSelectPanel, ‘numeric’);
app.DelaysEditField.ValueChangedFcn = createCallbackFcn(app, @DelaysEditFieldValueChanged, true);
app.DelaysEditField.Position = [128 9 34 22];
app.DelaysEditField.Value = 1;
% Create Select1064CheckBox
app.Select1064CheckBox = uicheckbox(app.ChannelSelectPanel);
app.Select1064CheckBox.ValueChangedFcn = createCallbackFcn(app, @Select1064CheckBoxValueChanged, true);
app.Select1064CheckBox.Text = ‘Select 1064’;
app.Select1064CheckBox.Position = [119 124 86 22];
% Create Select532CheckBox
app.Select532CheckBox = uicheckbox(app.ChannelSelectPanel);
app.Select532CheckBox.ValueChangedFcn = createCallbackFcn(app, @Select532CheckBoxValueChanged, true);
app.Select532CheckBox.Text = ‘Select 532’;
app.Select532CheckBox.Position = [119 101 79 22];
% Create Select355CheckBox
app.Select355CheckBox = uicheckbox(app.ChannelSelectPanel);
app.Select355CheckBox.ValueChangedFcn = createCallbackFcn(app, @Select355CheckBoxValueChanged, true);
app.Select355CheckBox.Text = ‘Select 355’;
app.Select355CheckBox.Position = [119 79 79 22];
% Create ControlPanel
app.ControlPanel = uipanel(app.LeftPanel);
app.ControlPanel.Title = ‘Control’;
app.ControlPanel.Position = [9 13 203 110];
% Create QuitButton
app.QuitButton = uibutton(app.ControlPanel, ‘push’);
app.QuitButton.ButtonPushedFcn = createCallbackFcn(app, @QuitButtonPushed, true);
app.QuitButton.FontWeight = ‘bold’;
app.QuitButton.FontColor = [1 0 0];
app.QuitButton.Position = [57 12 100 23];
app.QuitButton.Text = ‘Quit’;
% Create SelectDataFileButton
app.SelectDataFileButton = uibutton(app.ControlPanel, ‘push’);
app.SelectDataFileButton.ButtonPushedFcn = createCallbackFcn(app, @SelectDataFileButtonPushed, true);
app.SelectDataFileButton.Position = [57 54 100 23];
app.SelectDataFileButton.Text = ‘Select Data File’;
% Create RightPanel
app.RightPanel = uipanel(app.GridLayout);
app.RightPanel.Layout.Row = 1;
app.RightPanel.Layout.Column = 2;
% Create Panel3
app.Panel3 = uipanel(app.RightPanel);
app.Panel3.Title = ‘Panel3’;
app.Panel3.Position = [9 142 481 493];
% Create UIAxes
app.UIAxes = uiaxes(app.Panel3);
xlabel(app.UIAxes, ‘Counts’)
ylabel(app.UIAxes, ‘Altitude (km)’)
zlabel(app.UIAxes, ‘Z’)
app.UIAxes.GridLineWidth = 0.5;
app.UIAxes.MinorGridLineWidth = 0.5;
app.UIAxes.LineWidth = 0.5;
app.UIAxes.Box = ‘off’;
app.UIAxes.FontSize = 14;
app.UIAxes.Position = [4 0 475 469];
% Create Panel4
app.Panel4 = uipanel(app.RightPanel);
app.Panel4.Title = ‘Panel4’;
app.Panel4.Position = [9 10 479 123];
% Create FilenameEditFieldLabel
app.FilenameEditFieldLabel = uilabel(app.Panel4);
app.FilenameEditFieldLabel.HorizontalAlignment = ‘right’;
app.FilenameEditFieldLabel.Position = [14 75 53 22];
app.FilenameEditFieldLabel.Text = ‘Filename’;
% Create FilenameEditField
app.FilenameEditField = uieditfield(app.Panel4, ‘text’);
app.FilenameEditField.Position = [82 75 388 22];
% Create PathnameEditFieldLabel
app.PathnameEditFieldLabel = uilabel(app.Panel4);
app.PathnameEditFieldLabel.HorizontalAlignment = ‘right’;
app.PathnameEditFieldLabel.Position = [8 47 59 22];
app.PathnameEditFieldLabel.Text = ‘Pathname’;
% Create PathnameEditField
app.PathnameEditField = uieditfield(app.Panel4, ‘text’);
app.PathnameEditField.Position = [82 47 388 22];
% Create StatusEditFieldLabel
app.StatusEditFieldLabel = uilabel(app.Panel4);
app.StatusEditFieldLabel.HorizontalAlignment = ‘right’;
app.StatusEditFieldLabel.Position = [28 19 39 22];
app.StatusEditFieldLabel.Text = ‘Status’;
% Create StatusEditField
app.StatusEditField = uieditfield(app.Panel4, ‘text’);
app.StatusEditField.Position = [82 19 388 22];
% Show the figure after all components are created
app.RawdataPlotterAppUIFigure.Visible = ‘on’;
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = RawDataPlotterNew
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.RawdataPlotterAppUIFigure)
% 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.RawdataPlotterAppUIFigure)
end
end
end app designer, generated code, syntax error MATLAB Answers — New Questions