Category: Matlab
Category Archives: Matlab
how can we calculate surface area for this leaf in matlab?
<</matlabcentral/answers/uploaded_files/10685/images.jpg>>
only the leaf<</matlabcentral/answers/uploaded_files/10685/images.jpg>>
only the leaf <</matlabcentral/answers/uploaded_files/10685/images.jpg>>
only the leaf image segmentation, color segmentation, leaf MATLAB Answers — New Questions
MATLAB Web App: Multiple Page survey
I’m trying to make a GUI that takes in answers from multiple study participants. In the GUI, I want the participants to rate multiple audio files based on different questions. I’ve built a basic GUI in App Designer for rating one audio file (with placeholder question titles) and I want it to go to another page with the same structure for rating the subsequent audio files.
I’m a newcomer to MATLAB and needed some pointers on how I could do this. Would I need to create multiple .mlapp for all the audio files and somehow connect them as web apps? I don’t have any experience with working with web servers and databases, so I’m not sure how I would go about in deploying this app for collecting data. Ideally, I would like participants to answer the questions for all audio files (while keeping them anonymous) and save all their responses to a server in form of an excel sheet.
I’ve attached the basic look of the GUI (only for 1 audio) as a screenshot below.I’m trying to make a GUI that takes in answers from multiple study participants. In the GUI, I want the participants to rate multiple audio files based on different questions. I’ve built a basic GUI in App Designer for rating one audio file (with placeholder question titles) and I want it to go to another page with the same structure for rating the subsequent audio files.
I’m a newcomer to MATLAB and needed some pointers on how I could do this. Would I need to create multiple .mlapp for all the audio files and somehow connect them as web apps? I don’t have any experience with working with web servers and databases, so I’m not sure how I would go about in deploying this app for collecting data. Ideally, I would like participants to answer the questions for all audio files (while keeping them anonymous) and save all their responses to a server in form of an excel sheet.
I’ve attached the basic look of the GUI (only for 1 audio) as a screenshot below. I’m trying to make a GUI that takes in answers from multiple study participants. In the GUI, I want the participants to rate multiple audio files based on different questions. I’ve built a basic GUI in App Designer for rating one audio file (with placeholder question titles) and I want it to go to another page with the same structure for rating the subsequent audio files.
I’m a newcomer to MATLAB and needed some pointers on how I could do this. Would I need to create multiple .mlapp for all the audio files and somehow connect them as web apps? I don’t have any experience with working with web servers and databases, so I’m not sure how I would go about in deploying this app for collecting data. Ideally, I would like participants to answer the questions for all audio files (while keeping them anonymous) and save all their responses to a server in form of an excel sheet.
I’ve attached the basic look of the GUI (only for 1 audio) as a screenshot below. database, appdesigner MATLAB Answers — New Questions
Error in server block that is connected to entity generator containing bus elements.
Dear Matlab Experts,
I am having troubles with my model, right now I have designed a model to emulate a single part that goes through operations and maintenance procedures. I am utilizing bus elements in an entity generator, however upon initializing them (file initialize.m) and importing the file directly (file BusProfile.mat), and setting an initial value for each element used in the entity generator tab event actions, I am still encountering this error:
Error in ‘ModelV1/LoadStress’ block. See Service complete action line 15, column 9.
Caused by: This structure does not have a field ‘Missions’; new fields cannot be added when structure has been read or used.
Component:Simulink | Category:Block error
And this error persists for every element that is listed. Any ideas why this happens? I have checked everything up to looking for typos and I am unable to see what is the problem.
Thank you in advance.Dear Matlab Experts,
I am having troubles with my model, right now I have designed a model to emulate a single part that goes through operations and maintenance procedures. I am utilizing bus elements in an entity generator, however upon initializing them (file initialize.m) and importing the file directly (file BusProfile.mat), and setting an initial value for each element used in the entity generator tab event actions, I am still encountering this error:
Error in ‘ModelV1/LoadStress’ block. See Service complete action line 15, column 9.
Caused by: This structure does not have a field ‘Missions’; new fields cannot be added when structure has been read or used.
Component:Simulink | Category:Block error
And this error persists for every element that is listed. Any ideas why this happens? I have checked everything up to looking for typos and I am unable to see what is the problem.
Thank you in advance. Dear Matlab Experts,
I am having troubles with my model, right now I have designed a model to emulate a single part that goes through operations and maintenance procedures. I am utilizing bus elements in an entity generator, however upon initializing them (file initialize.m) and importing the file directly (file BusProfile.mat), and setting an initial value for each element used in the entity generator tab event actions, I am still encountering this error:
Error in ‘ModelV1/LoadStress’ block. See Service complete action line 15, column 9.
Caused by: This structure does not have a field ‘Missions’; new fields cannot be added when structure has been read or used.
Component:Simulink | Category:Block error
And this error persists for every element that is listed. Any ideas why this happens? I have checked everything up to looking for typos and I am unable to see what is the problem.
Thank you in advance. simulink, matlab MATLAB Answers — New Questions
validate arguments stop implicit expansion
classdef Car
properties
id
position
end
methods
function obj = Car(id, position)
arguments
id (1,1) {mustBeNumeric, mustBePositive, mustBeInteger, mustBeNonempty}
position (1,3) double {mustBeVector, mustBeNonempty}
end
obj.id = id;
obj.position = position;
end
end
end
myCar = Car(42, 20)
Instantiation of myCar creates position vector [20, 20, 20]. This is because of implicity expansion. I am trying to stop this by adding a custom validator, but having trouble.classdef Car
properties
id
position
end
methods
function obj = Car(id, position)
arguments
id (1,1) {mustBeNumeric, mustBePositive, mustBeInteger, mustBeNonempty}
position (1,3) double {mustBeVector, mustBeNonempty}
end
obj.id = id;
obj.position = position;
end
end
end
myCar = Car(42, 20)
Instantiation of myCar creates position vector [20, 20, 20]. This is because of implicity expansion. I am trying to stop this by adding a custom validator, but having trouble. classdef Car
properties
id
position
end
methods
function obj = Car(id, position)
arguments
id (1,1) {mustBeNumeric, mustBePositive, mustBeInteger, mustBeNonempty}
position (1,3) double {mustBeVector, mustBeNonempty}
end
obj.id = id;
obj.position = position;
end
end
end
myCar = Car(42, 20)
Instantiation of myCar creates position vector [20, 20, 20]. This is because of implicity expansion. I am trying to stop this by adding a custom validator, but having trouble. implicit expansion validation MATLAB Answers — New Questions
Solving 5 equations (time domain)
<</matlabcentral/answers/uploaded_files/1733763/CamScanner%2007-12-2024%2020.57_01.jpg>>
Can some body write a code to solve these equations ? These are kcl equations in a circuits .
F1(n)=Cg*((Vi(n)-Vi(n-1))/ts)-Cg*((Vg(n)-Vg(n-1))/ts)+(1/R1)*(Vi(n)-Vs(n));
F2(n)=(Cg)*((Vg(n)+Vg(n-2)-2*Vg(n-1))/ts^2)-Cg*((Vi(n)+Vi(n-2)-2*Vi(n-1))/ts^2)+(1/Lg)*(Vg(n)-Vgg)+(1/L1)*(Vg(n)-Vgs(n));
F3(n)=(Cgs(n)+C1)*((Vgs(n)+Vgs(n-2)-2*Vgs(n-1))/ts^2)+(1/L1)*(Vgs(n)-Vg(n))+((Cgs(n)-Cgs(n-1))/ts)*((Vgs(n)-Vgs(n-1))/ts);
F4(n)=(1/Ld)*(Vds(n)-Vdd)+(Cd)*((Vds(n)+Vds(n-2)-2*Vds(n-1))/ts^2)-(Cd)*((Vo(n)+Vo(n-2)-2*Vo(n-1))/ts^2)+((Ids(n)-Ids(n-1))/ts);
F5(n)=Cd*((Vo(n)-Vo(n-1))/(ts))+(Vds(n)-Vds(n-1))/ts;<</matlabcentral/answers/uploaded_files/1733763/CamScanner%2007-12-2024%2020.57_01.jpg>>
Can some body write a code to solve these equations ? These are kcl equations in a circuits .
F1(n)=Cg*((Vi(n)-Vi(n-1))/ts)-Cg*((Vg(n)-Vg(n-1))/ts)+(1/R1)*(Vi(n)-Vs(n));
F2(n)=(Cg)*((Vg(n)+Vg(n-2)-2*Vg(n-1))/ts^2)-Cg*((Vi(n)+Vi(n-2)-2*Vi(n-1))/ts^2)+(1/Lg)*(Vg(n)-Vgg)+(1/L1)*(Vg(n)-Vgs(n));
F3(n)=(Cgs(n)+C1)*((Vgs(n)+Vgs(n-2)-2*Vgs(n-1))/ts^2)+(1/L1)*(Vgs(n)-Vg(n))+((Cgs(n)-Cgs(n-1))/ts)*((Vgs(n)-Vgs(n-1))/ts);
F4(n)=(1/Ld)*(Vds(n)-Vdd)+(Cd)*((Vds(n)+Vds(n-2)-2*Vds(n-1))/ts^2)-(Cd)*((Vo(n)+Vo(n-2)-2*Vo(n-1))/ts^2)+((Ids(n)-Ids(n-1))/ts);
F5(n)=Cd*((Vo(n)-Vo(n-1))/(ts))+(Vds(n)-Vds(n-1))/ts; <</matlabcentral/answers/uploaded_files/1733763/CamScanner%2007-12-2024%2020.57_01.jpg>>
Can some body write a code to solve these equations ? These are kcl equations in a circuits .
F1(n)=Cg*((Vi(n)-Vi(n-1))/ts)-Cg*((Vg(n)-Vg(n-1))/ts)+(1/R1)*(Vi(n)-Vs(n));
F2(n)=(Cg)*((Vg(n)+Vg(n-2)-2*Vg(n-1))/ts^2)-Cg*((Vi(n)+Vi(n-2)-2*Vi(n-1))/ts^2)+(1/Lg)*(Vg(n)-Vgg)+(1/L1)*(Vg(n)-Vgs(n));
F3(n)=(Cgs(n)+C1)*((Vgs(n)+Vgs(n-2)-2*Vgs(n-1))/ts^2)+(1/L1)*(Vgs(n)-Vg(n))+((Cgs(n)-Cgs(n-1))/ts)*((Vgs(n)-Vgs(n-1))/ts);
F4(n)=(1/Ld)*(Vds(n)-Vdd)+(Cd)*((Vds(n)+Vds(n-2)-2*Vds(n-1))/ts^2)-(Cd)*((Vo(n)+Vo(n-2)-2*Vo(n-1))/ts^2)+((Ids(n)-Ids(n-1))/ts);
F5(n)=Cd*((Vo(n)-Vo(n-1))/(ts))+(Vds(n)-Vds(n-1))/ts; time domain solution in matlab MATLAB Answers — New Questions
Keyboard input is not working in Matlab GUIs on Ubuntu 18.04
Hello Matlab Community,
recently I installed Matlab2018a on my Ubuntu 18.04. After the installation was completed I tried to open Matlab GUIs but it did not work. I followed following instructions:
—
cd /usr/local/MATLAB/R2017b
cd cefclient/sys/os/glnxa64
mkdir exclude
mv libglib-2.0.so* exclude/
—
Afterwards I was able to open Matlab GUIs as e.g. Appdesigner, Simulink or the Log In window.
Unfortunately its not possible to make keyboard inputs neither to ‘Edit Fields’ nor to the appdesigner code editor. Summarized: Keyboard inputs in any matlab gui are effectless. Does anybody know a solution?
I look forward to your suggestions.
regards
NilsHello Matlab Community,
recently I installed Matlab2018a on my Ubuntu 18.04. After the installation was completed I tried to open Matlab GUIs but it did not work. I followed following instructions:
—
cd /usr/local/MATLAB/R2017b
cd cefclient/sys/os/glnxa64
mkdir exclude
mv libglib-2.0.so* exclude/
—
Afterwards I was able to open Matlab GUIs as e.g. Appdesigner, Simulink or the Log In window.
Unfortunately its not possible to make keyboard inputs neither to ‘Edit Fields’ nor to the appdesigner code editor. Summarized: Keyboard inputs in any matlab gui are effectless. Does anybody know a solution?
I look forward to your suggestions.
regards
Nils Hello Matlab Community,
recently I installed Matlab2018a on my Ubuntu 18.04. After the installation was completed I tried to open Matlab GUIs but it did not work. I followed following instructions:
—
cd /usr/local/MATLAB/R2017b
cd cefclient/sys/os/glnxa64
mkdir exclude
mv libglib-2.0.so* exclude/
—
Afterwards I was able to open Matlab GUIs as e.g. Appdesigner, Simulink or the Log In window.
Unfortunately its not possible to make keyboard inputs neither to ‘Edit Fields’ nor to the appdesigner code editor. Summarized: Keyboard inputs in any matlab gui are effectless. Does anybody know a solution?
I look forward to your suggestions.
regards
Nils ubuntu, ubuntu 18.04, matlab gui, matlab 2018a, libglib-2.0, gui, linux MATLAB Answers — New Questions
High BER with comm.RayTracingChannel when MaxNumReflections is Set to 0
Hi,
I’m working on writing a code to evaluate BER using comm.RayTracingChannel. I’m referencing the example "Indoor MIMO-OFDM Communication Link Using Ray Tracing". In this example, when I set MaxNumReflections to 0, allowing only the direct path, the BER comes out to be close to 50%.
I don’t understand why this happens. Realistically, in a chamber LOS environment, measuring BER should result in only a direct path and a very low BER. Why does the example produce such a high BER?
Any insights would be greatly appreciated.
Thanks.Hi,
I’m working on writing a code to evaluate BER using comm.RayTracingChannel. I’m referencing the example "Indoor MIMO-OFDM Communication Link Using Ray Tracing". In this example, when I set MaxNumReflections to 0, allowing only the direct path, the BER comes out to be close to 50%.
I don’t understand why this happens. Realistically, in a chamber LOS environment, measuring BER should result in only a direct path and a very low BER. Why does the example produce such a high BER?
Any insights would be greatly appreciated.
Thanks. Hi,
I’m working on writing a code to evaluate BER using comm.RayTracingChannel. I’m referencing the example "Indoor MIMO-OFDM Communication Link Using Ray Tracing". In this example, when I set MaxNumReflections to 0, allowing only the direct path, the BER comes out to be close to 50%.
I don’t understand why this happens. Realistically, in a chamber LOS environment, measuring BER should result in only a direct path and a very low BER. Why does the example produce such a high BER?
Any insights would be greatly appreciated.
Thanks. # ray tracing, #communication #mimo #ofdm MATLAB Answers — New Questions
Problem connecting reliably to Thingspeak over Ethernet
I have been trying to set up a Feather MO plus Ethernet wing to connect to my Thingspeak account. The project will report temperature, humidity, atmospheric pressure and calculate dew point using a BMP280 sensor board every 60 seconds. I’ve written my own code, I’ve also tried other peoples code, I’ve updated all the libraries. The programs are short and simple and they will run for a while (several hours), then fail. When reporting via the IDE they report -304 or -302 errors first, then -301. When the code runs directly connected to the internet it runs for longer but then fails after a few days.
In my latest attempt I took a Mathworks code example directly from Github and only made minor changes to suit the Thingspeak format that I was sending the data to (see below). This code doesn’t use the BME280 or any other code at all, it is just the Mathworks code. The results were the same, it runs for a few hours then reports –304 (Timeout) a few times then recovers, then -302 (Unexpected fail) and then finally, repeated -301 (Connect fail). I suppose I could work around the issue with a Watch Dog Timer but that shouldn’t be necessary.
I now suspect that the problem may be with my router/modem settings (Arris DG3270A) – an area I know very little about. Can anyone suggest what the problem may be and how to fix it? Thank you.
Michael
/*
WriteMultipleFields
Description: Writes values to fields 1,2,3 and 4 in a single ThingSpeak update every 20 seconds.
Hardware: Arduino Ethernet
!!! IMPORTANT – Modify the secrets.h file for this project with your network connection and ThingSpeak channel details. !!!
Note:
– Requires the Ethernet library
ThingSpeak ( https://www.thingspeak.com ) is an analytic IoT platform service that allows you to aggregate, visualize, and
analyze live data streams in the cloud. Visit https://www.thingspeak.com to sign up for a free account and create a channel.
Documentation for the ThingSpeak Communication Library for Arduino is in the README.md folder where the library was installed.
See https://www.mathworks.com/help/thingspeak/index.html for the full ThingSpeak documentation.
For licensing information, see the accompanying license file.
Copyright 2020, The MathWorks, Inc.
*/
#include <Ethernet.h>
#include "Ethernetsecrets.h"
#include "ThingSpeak.h" // always include thingspeak header file after other header files and custom macros
byte mac[] = SECRET_MAC;
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);
IPAddress myDns(192, 168, 0, 1); //changed to 4 from 1
EthernetClient client;
unsigned long myChannelNumber = SECRET_CH_ID;
const char * myWriteAPIKey = SECRET_WRITE_APIKEY;
// Initialize our values
int number1 = 56;
int number2 = random(20,30);
int number3 = random(900,1000);
int number4 = random(0,20);
void setup() {
Ethernet.init(10); // 10 is for most Arduino Ethernet hardware
Serial.begin(115200); //Initialize serial
// start the Ethernet connection:
Serial.println("Initialize Ethernet with DHCP:");
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found. Sorry, can’t run without hardware. :(");
while (true) {
delay(1); // do nothing, no point running without Ethernet hardware
}
}
if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is not connected.");
}
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip, myDns);
} else {
Serial.print(" DHCP assigned IP ");
Serial.println(Ethernet.localIP());
}
// give the Ethernet shield a second to initialize:
delay(1000);
ThingSpeak.begin(client); // Initialize ThingSpeak
}
void loop() {
// set the fields with the values
ThingSpeak.setField(1, number1);
ThingSpeak.setField(2, number2);
ThingSpeak.setField(3, number3);
ThingSpeak.setField(4, number4);
// write to the ThingSpeak channel
int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
if(x == 200){
Serial.println("Channel update successful.");
}
else{
Serial.println("Problem updating channel. HTTP error code " + String(x));
}
number1 = 56;
number2 = random(20,30);
number3 = random(900,1000);
number4 = random(0,20);
delay(60000); // Wait 60 seconds to update the channel again
}I have been trying to set up a Feather MO plus Ethernet wing to connect to my Thingspeak account. The project will report temperature, humidity, atmospheric pressure and calculate dew point using a BMP280 sensor board every 60 seconds. I’ve written my own code, I’ve also tried other peoples code, I’ve updated all the libraries. The programs are short and simple and they will run for a while (several hours), then fail. When reporting via the IDE they report -304 or -302 errors first, then -301. When the code runs directly connected to the internet it runs for longer but then fails after a few days.
In my latest attempt I took a Mathworks code example directly from Github and only made minor changes to suit the Thingspeak format that I was sending the data to (see below). This code doesn’t use the BME280 or any other code at all, it is just the Mathworks code. The results were the same, it runs for a few hours then reports –304 (Timeout) a few times then recovers, then -302 (Unexpected fail) and then finally, repeated -301 (Connect fail). I suppose I could work around the issue with a Watch Dog Timer but that shouldn’t be necessary.
I now suspect that the problem may be with my router/modem settings (Arris DG3270A) – an area I know very little about. Can anyone suggest what the problem may be and how to fix it? Thank you.
Michael
/*
WriteMultipleFields
Description: Writes values to fields 1,2,3 and 4 in a single ThingSpeak update every 20 seconds.
Hardware: Arduino Ethernet
!!! IMPORTANT – Modify the secrets.h file for this project with your network connection and ThingSpeak channel details. !!!
Note:
– Requires the Ethernet library
ThingSpeak ( https://www.thingspeak.com ) is an analytic IoT platform service that allows you to aggregate, visualize, and
analyze live data streams in the cloud. Visit https://www.thingspeak.com to sign up for a free account and create a channel.
Documentation for the ThingSpeak Communication Library for Arduino is in the README.md folder where the library was installed.
See https://www.mathworks.com/help/thingspeak/index.html for the full ThingSpeak documentation.
For licensing information, see the accompanying license file.
Copyright 2020, The MathWorks, Inc.
*/
#include <Ethernet.h>
#include "Ethernetsecrets.h"
#include "ThingSpeak.h" // always include thingspeak header file after other header files and custom macros
byte mac[] = SECRET_MAC;
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);
IPAddress myDns(192, 168, 0, 1); //changed to 4 from 1
EthernetClient client;
unsigned long myChannelNumber = SECRET_CH_ID;
const char * myWriteAPIKey = SECRET_WRITE_APIKEY;
// Initialize our values
int number1 = 56;
int number2 = random(20,30);
int number3 = random(900,1000);
int number4 = random(0,20);
void setup() {
Ethernet.init(10); // 10 is for most Arduino Ethernet hardware
Serial.begin(115200); //Initialize serial
// start the Ethernet connection:
Serial.println("Initialize Ethernet with DHCP:");
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found. Sorry, can’t run without hardware. :(");
while (true) {
delay(1); // do nothing, no point running without Ethernet hardware
}
}
if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is not connected.");
}
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip, myDns);
} else {
Serial.print(" DHCP assigned IP ");
Serial.println(Ethernet.localIP());
}
// give the Ethernet shield a second to initialize:
delay(1000);
ThingSpeak.begin(client); // Initialize ThingSpeak
}
void loop() {
// set the fields with the values
ThingSpeak.setField(1, number1);
ThingSpeak.setField(2, number2);
ThingSpeak.setField(3, number3);
ThingSpeak.setField(4, number4);
// write to the ThingSpeak channel
int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
if(x == 200){
Serial.println("Channel update successful.");
}
else{
Serial.println("Problem updating channel. HTTP error code " + String(x));
}
number1 = 56;
number2 = random(20,30);
number3 = random(900,1000);
number4 = random(0,20);
delay(60000); // Wait 60 seconds to update the channel again
} I have been trying to set up a Feather MO plus Ethernet wing to connect to my Thingspeak account. The project will report temperature, humidity, atmospheric pressure and calculate dew point using a BMP280 sensor board every 60 seconds. I’ve written my own code, I’ve also tried other peoples code, I’ve updated all the libraries. The programs are short and simple and they will run for a while (several hours), then fail. When reporting via the IDE they report -304 or -302 errors first, then -301. When the code runs directly connected to the internet it runs for longer but then fails after a few days.
In my latest attempt I took a Mathworks code example directly from Github and only made minor changes to suit the Thingspeak format that I was sending the data to (see below). This code doesn’t use the BME280 or any other code at all, it is just the Mathworks code. The results were the same, it runs for a few hours then reports –304 (Timeout) a few times then recovers, then -302 (Unexpected fail) and then finally, repeated -301 (Connect fail). I suppose I could work around the issue with a Watch Dog Timer but that shouldn’t be necessary.
I now suspect that the problem may be with my router/modem settings (Arris DG3270A) – an area I know very little about. Can anyone suggest what the problem may be and how to fix it? Thank you.
Michael
/*
WriteMultipleFields
Description: Writes values to fields 1,2,3 and 4 in a single ThingSpeak update every 20 seconds.
Hardware: Arduino Ethernet
!!! IMPORTANT – Modify the secrets.h file for this project with your network connection and ThingSpeak channel details. !!!
Note:
– Requires the Ethernet library
ThingSpeak ( https://www.thingspeak.com ) is an analytic IoT platform service that allows you to aggregate, visualize, and
analyze live data streams in the cloud. Visit https://www.thingspeak.com to sign up for a free account and create a channel.
Documentation for the ThingSpeak Communication Library for Arduino is in the README.md folder where the library was installed.
See https://www.mathworks.com/help/thingspeak/index.html for the full ThingSpeak documentation.
For licensing information, see the accompanying license file.
Copyright 2020, The MathWorks, Inc.
*/
#include <Ethernet.h>
#include "Ethernetsecrets.h"
#include "ThingSpeak.h" // always include thingspeak header file after other header files and custom macros
byte mac[] = SECRET_MAC;
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);
IPAddress myDns(192, 168, 0, 1); //changed to 4 from 1
EthernetClient client;
unsigned long myChannelNumber = SECRET_CH_ID;
const char * myWriteAPIKey = SECRET_WRITE_APIKEY;
// Initialize our values
int number1 = 56;
int number2 = random(20,30);
int number3 = random(900,1000);
int number4 = random(0,20);
void setup() {
Ethernet.init(10); // 10 is for most Arduino Ethernet hardware
Serial.begin(115200); //Initialize serial
// start the Ethernet connection:
Serial.println("Initialize Ethernet with DHCP:");
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found. Sorry, can’t run without hardware. :(");
while (true) {
delay(1); // do nothing, no point running without Ethernet hardware
}
}
if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is not connected.");
}
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip, myDns);
} else {
Serial.print(" DHCP assigned IP ");
Serial.println(Ethernet.localIP());
}
// give the Ethernet shield a second to initialize:
delay(1000);
ThingSpeak.begin(client); // Initialize ThingSpeak
}
void loop() {
// set the fields with the values
ThingSpeak.setField(1, number1);
ThingSpeak.setField(2, number2);
ThingSpeak.setField(3, number3);
ThingSpeak.setField(4, number4);
// write to the ThingSpeak channel
int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
if(x == 200){
Serial.println("Channel update successful.");
}
else{
Serial.println("Problem updating channel. HTTP error code " + String(x));
}
number1 = 56;
number2 = random(20,30);
number3 = random(900,1000);
number4 = random(0,20);
delay(60000); // Wait 60 seconds to update the channel again
} thingspeak, feather, ethernet wing MATLAB Answers — New Questions
dual solution for skin friction and nusselt number and sheerword number using bvp4c solver: mathematical equations and the code is given in description.
Artical:Unsteady boundary-layer flow and heat transfer of a nanofluid over a permeable stretching/shrinking sheet
here are the mathematical equations:
f^”’+A(ff^”-f^’2 )+f^’+η/2 f^”=0
1/Pr θ^”+(Af+η/2) θ^’+Nbθ^’ φ^’+Nt(θ^’ )^2=0
φ^”+Le(Af+η/2) φ^’+Nt/Nb θ^”=0
boundary conditions:
f(0)=s, f^’ (0)=λ, θ(0)=1,φ(0)=1
f^’ (η)→0,θ(η)→0,φ (η)→0 as η→inf
the code is :
Ibrardual()
function Ibrardual
clc
clear all
Nt=0.5; Nb=0.5; Le=2; Pr=1; alpha=1.5; s=1; A=3;
%% solution in structure form
%First solution
sol = bvpinit(linspace(0,6,10), [0 0 0 0 0 0 0]);
sol1 = bvp4c(@bvpexam2, @bcexam2, sol);
x1 = sol1.x;
y1 = sol1.y;
% Second solution
opts = bvpset(‘stats’,’off’,’RelTol’,1e-10);
sol = bvpinit(linspace(0,5,10), [-1 0 0 0 0 0 0]);
sol2 = bvp4c(@bvpexam2, @bcexam2_dual, sol,opts);
x2 = sol2.x;
y2 = sol2.y;
% Plot both solutions
plot(x1,y1(3,:),’-‘); hold on
plot(x2,y2(3,:),’–‘);
xlabel(‘eta’)
ylabel(‘f`(eta)’)
result1 = A^(-1/2)*y1(3,1)
result2 = A^(-1/2)*y2(3,1)
%%residual of bcs
function res = bcexam2(y0, yinf)
res= [y0(1)-s; y0(2)-alpha; y0(4)-1; y0(6)-1; yinf(2); yinf(4);yinf(6)];
end
function res = bcexam2_dual(y0, yinf)
res= [y0(1)-s; y0(2)-alpha; y0(4)-1; y0(6)-1; yinf(2); yinf(4);yinf(6)];
end
%% first order odes
function ysol = bvpexam2(x,y)
yy1 = -(A*y(1)*y(3)-A*(y(2))^2)-y(2)-(x/2)*y(3);
yy2 = -Pr*(A*y(1)*y(5)+(x/2)*y(5)+Nb*y(5)*y(7)+Nt*(y(5))^2);
yy3 = (-Le*(A*(y(1)*y(7)+(x/2)*y(7)))-(Nt/Nb)*( -Pr*(A*y(1)*y(5)+Nb*y(5)*y(7)+Nt*(y(5))^2)));
ysol = [y(2); y(3); yy1;y(5);yy2;y(7);yy3];
end
endArtical:Unsteady boundary-layer flow and heat transfer of a nanofluid over a permeable stretching/shrinking sheet
here are the mathematical equations:
f^”’+A(ff^”-f^’2 )+f^’+η/2 f^”=0
1/Pr θ^”+(Af+η/2) θ^’+Nbθ^’ φ^’+Nt(θ^’ )^2=0
φ^”+Le(Af+η/2) φ^’+Nt/Nb θ^”=0
boundary conditions:
f(0)=s, f^’ (0)=λ, θ(0)=1,φ(0)=1
f^’ (η)→0,θ(η)→0,φ (η)→0 as η→inf
the code is :
Ibrardual()
function Ibrardual
clc
clear all
Nt=0.5; Nb=0.5; Le=2; Pr=1; alpha=1.5; s=1; A=3;
%% solution in structure form
%First solution
sol = bvpinit(linspace(0,6,10), [0 0 0 0 0 0 0]);
sol1 = bvp4c(@bvpexam2, @bcexam2, sol);
x1 = sol1.x;
y1 = sol1.y;
% Second solution
opts = bvpset(‘stats’,’off’,’RelTol’,1e-10);
sol = bvpinit(linspace(0,5,10), [-1 0 0 0 0 0 0]);
sol2 = bvp4c(@bvpexam2, @bcexam2_dual, sol,opts);
x2 = sol2.x;
y2 = sol2.y;
% Plot both solutions
plot(x1,y1(3,:),’-‘); hold on
plot(x2,y2(3,:),’–‘);
xlabel(‘eta’)
ylabel(‘f`(eta)’)
result1 = A^(-1/2)*y1(3,1)
result2 = A^(-1/2)*y2(3,1)
%%residual of bcs
function res = bcexam2(y0, yinf)
res= [y0(1)-s; y0(2)-alpha; y0(4)-1; y0(6)-1; yinf(2); yinf(4);yinf(6)];
end
function res = bcexam2_dual(y0, yinf)
res= [y0(1)-s; y0(2)-alpha; y0(4)-1; y0(6)-1; yinf(2); yinf(4);yinf(6)];
end
%% first order odes
function ysol = bvpexam2(x,y)
yy1 = -(A*y(1)*y(3)-A*(y(2))^2)-y(2)-(x/2)*y(3);
yy2 = -Pr*(A*y(1)*y(5)+(x/2)*y(5)+Nb*y(5)*y(7)+Nt*(y(5))^2);
yy3 = (-Le*(A*(y(1)*y(7)+(x/2)*y(7)))-(Nt/Nb)*( -Pr*(A*y(1)*y(5)+Nb*y(5)*y(7)+Nt*(y(5))^2)));
ysol = [y(2); y(3); yy1;y(5);yy2;y(7);yy3];
end
end Artical:Unsteady boundary-layer flow and heat transfer of a nanofluid over a permeable stretching/shrinking sheet
here are the mathematical equations:
f^”’+A(ff^”-f^’2 )+f^’+η/2 f^”=0
1/Pr θ^”+(Af+η/2) θ^’+Nbθ^’ φ^’+Nt(θ^’ )^2=0
φ^”+Le(Af+η/2) φ^’+Nt/Nb θ^”=0
boundary conditions:
f(0)=s, f^’ (0)=λ, θ(0)=1,φ(0)=1
f^’ (η)→0,θ(η)→0,φ (η)→0 as η→inf
the code is :
Ibrardual()
function Ibrardual
clc
clear all
Nt=0.5; Nb=0.5; Le=2; Pr=1; alpha=1.5; s=1; A=3;
%% solution in structure form
%First solution
sol = bvpinit(linspace(0,6,10), [0 0 0 0 0 0 0]);
sol1 = bvp4c(@bvpexam2, @bcexam2, sol);
x1 = sol1.x;
y1 = sol1.y;
% Second solution
opts = bvpset(‘stats’,’off’,’RelTol’,1e-10);
sol = bvpinit(linspace(0,5,10), [-1 0 0 0 0 0 0]);
sol2 = bvp4c(@bvpexam2, @bcexam2_dual, sol,opts);
x2 = sol2.x;
y2 = sol2.y;
% Plot both solutions
plot(x1,y1(3,:),’-‘); hold on
plot(x2,y2(3,:),’–‘);
xlabel(‘eta’)
ylabel(‘f`(eta)’)
result1 = A^(-1/2)*y1(3,1)
result2 = A^(-1/2)*y2(3,1)
%%residual of bcs
function res = bcexam2(y0, yinf)
res= [y0(1)-s; y0(2)-alpha; y0(4)-1; y0(6)-1; yinf(2); yinf(4);yinf(6)];
end
function res = bcexam2_dual(y0, yinf)
res= [y0(1)-s; y0(2)-alpha; y0(4)-1; y0(6)-1; yinf(2); yinf(4);yinf(6)];
end
%% first order odes
function ysol = bvpexam2(x,y)
yy1 = -(A*y(1)*y(3)-A*(y(2))^2)-y(2)-(x/2)*y(3);
yy2 = -Pr*(A*y(1)*y(5)+(x/2)*y(5)+Nb*y(5)*y(7)+Nt*(y(5))^2);
yy3 = (-Le*(A*(y(1)*y(7)+(x/2)*y(7)))-(Nt/Nb)*( -Pr*(A*y(1)*y(5)+Nb*y(5)*y(7)+Nt*(y(5))^2)));
ysol = [y(2); y(3); yy1;y(5);yy2;y(7);yy3];
end
end matlab MATLAB Answers — New Questions
Prevent Matlab from updating the legend when saving a figure
I have a figure with a tiled layout and some plots which – because they are partly related – I don’t want to give them all their own legend entry, but rather summarise several plots with one entry. I do this by subsequently changing the legend entries to display several line types, like in this example:
leg = legend([plot1, plot2], {‘Plot1’, ‘Plot2’});
drawnow();
% Update legend
hLegendEntryTop = leg.EntryContainer.NodeChildren(end); % top row of legend
iconSet = hLegendEntryTop.Icon.Transform.Children.Children; % array of icons
% Move primary line up
iconSet(1).VertexData(2,1) = 0.65;
iconSet(1).VertexData(2,2) = 0.65;
% Create a new line
iconSet(2) = copy(iconSet(1)); % copy the object
iconSet(2) = iconSet(1).Parent; % set the parent, adding to the legend’s icon draw set
% Move primary line down
iconSet(2).VertexData(2,1) = 0.35;
iconSet(2).VertexData(2,2) = 0.35;
iconSet(2).LineStyle = ‘dashed’;
…… % Do the same with other plot lines
saveas(gcf,’figure’,’epsc’)
Interestingly, it works when exporting as PNG, but not when exporting as eps or pdf (vector graphics). The image is then updated and all additional lines inserted disappear again. I have absolutely no idea how I can prevent Matlab from updating the legend again when saving.I have a figure with a tiled layout and some plots which – because they are partly related – I don’t want to give them all their own legend entry, but rather summarise several plots with one entry. I do this by subsequently changing the legend entries to display several line types, like in this example:
leg = legend([plot1, plot2], {‘Plot1’, ‘Plot2’});
drawnow();
% Update legend
hLegendEntryTop = leg.EntryContainer.NodeChildren(end); % top row of legend
iconSet = hLegendEntryTop.Icon.Transform.Children.Children; % array of icons
% Move primary line up
iconSet(1).VertexData(2,1) = 0.65;
iconSet(1).VertexData(2,2) = 0.65;
% Create a new line
iconSet(2) = copy(iconSet(1)); % copy the object
iconSet(2) = iconSet(1).Parent; % set the parent, adding to the legend’s icon draw set
% Move primary line down
iconSet(2).VertexData(2,1) = 0.35;
iconSet(2).VertexData(2,2) = 0.35;
iconSet(2).LineStyle = ‘dashed’;
…… % Do the same with other plot lines
saveas(gcf,’figure’,’epsc’)
Interestingly, it works when exporting as PNG, but not when exporting as eps or pdf (vector graphics). The image is then updated and all additional lines inserted disappear again. I have absolutely no idea how I can prevent Matlab from updating the legend again when saving. I have a figure with a tiled layout and some plots which – because they are partly related – I don’t want to give them all their own legend entry, but rather summarise several plots with one entry. I do this by subsequently changing the legend entries to display several line types, like in this example:
leg = legend([plot1, plot2], {‘Plot1’, ‘Plot2’});
drawnow();
% Update legend
hLegendEntryTop = leg.EntryContainer.NodeChildren(end); % top row of legend
iconSet = hLegendEntryTop.Icon.Transform.Children.Children; % array of icons
% Move primary line up
iconSet(1).VertexData(2,1) = 0.65;
iconSet(1).VertexData(2,2) = 0.65;
% Create a new line
iconSet(2) = copy(iconSet(1)); % copy the object
iconSet(2) = iconSet(1).Parent; % set the parent, adding to the legend’s icon draw set
% Move primary line down
iconSet(2).VertexData(2,1) = 0.35;
iconSet(2).VertexData(2,2) = 0.35;
iconSet(2).LineStyle = ‘dashed’;
…… % Do the same with other plot lines
saveas(gcf,’figure’,’epsc’)
Interestingly, it works when exporting as PNG, but not when exporting as eps or pdf (vector graphics). The image is then updated and all additional lines inserted disappear again. I have absolutely no idea how I can prevent Matlab from updating the legend again when saving. save, legend MATLAB Answers — New Questions
What is the autocorrelation of the Gaussian random noise sequence N = 20
What is the autocorrelation of the Gaussian random noise sequence N = 20What is the autocorrelation of the Gaussian random noise sequence N = 20 What is the autocorrelation of the Gaussian random noise sequence N = 20 dsp MATLAB Answers — New Questions
The Output structure of a code is showing different outputs in command window and workspace
When working on a program, after executing it and checking output in MATLAB command window and in output from workspace is giving different outputs. Which is correct output here and what is this happening?
Command window output:
Workspace output:When working on a program, after executing it and checking output in MATLAB command window and in output from workspace is giving different outputs. Which is correct output here and what is this happening?
Command window output:
Workspace output: When working on a program, after executing it and checking output in MATLAB command window and in output from workspace is giving different outputs. Which is correct output here and what is this happening?
Command window output:
Workspace output: output matlab MATLAB Answers — New Questions
I need to connect physical modelling connection port to the output of a switch with 2 input. How can I establish this?
Post Content Post Content multiple source connection MATLAB Answers — New Questions
How to retrieve datas from multiples GUIs into a function ?
Hello everyone !
I have several GUI windows to collect parameters and I want to use them in functions.
The problem is, I store datas from edit text boxes into arrays like that :
typex=getappdata(hObject,’typex’);
typex(end+1)=str2double(handles.typex(1).String);
handles.typex(1).String=sprintf(‘block %d’,numel(typex)+1);
disp(typex)
setappdata(hObject,’typex’,typex);
assignin(‘base’,’typex’,typex);
Then, in a callback I use them in the same GUI:
xw=getappdata(handles.xw(1),’xw’);
xe=getappdata(handles.xe(1),’xe’);
nx=getappdata(handles.nx(1),’nx’);
typex=getappdata(handles.typex(1),’typex’);
%Choix du programme de rafinement a executer
if(typex==1)
n=length(nx);
for i=1:n
xwt=xw(i);
xet=xe(i);
nxt=nx(i);
create_block_uniform_X(xwt, xet, nxt)
end
That does works.
But in an other function, I use that to retrieve the datas:
X=getappdata(0,’X’)
Y=getappdata(0,’Y’)
Z=getappdata(0,’Z’)
nx=getappdata(0,’nx’)
xw=getappdata(0,’xw’)
xe=getappdata(0,’xe’)
ny=getappdata(0,’ny’)
yw=getappdata(0,’yw’)
ye=getappdata(0,’ye’)
nz=getappdata(0,’nz’)
zw=getappdata(0,’zw’)
ze=getappdata(0,’ze’)
The thing is that for X,Y,Z it does retrieve the datas (X, Y, Z are the outputs arguments from the previous fonction ‘create_block_uniform’) but that return empty arrays for the others… I don’t understand
Z =
Columns 1 through 13
0 1.1111 2.2222 3.3333 4.4444 5.5556 6.6667 7.7778 8.8889 10.0000 0 0 0
Columns 14 through 18
0 0 0 0 0
nx =
[]
xw =
[]
xe =
[]
Could someone help me ?
Thanks !Hello everyone !
I have several GUI windows to collect parameters and I want to use them in functions.
The problem is, I store datas from edit text boxes into arrays like that :
typex=getappdata(hObject,’typex’);
typex(end+1)=str2double(handles.typex(1).String);
handles.typex(1).String=sprintf(‘block %d’,numel(typex)+1);
disp(typex)
setappdata(hObject,’typex’,typex);
assignin(‘base’,’typex’,typex);
Then, in a callback I use them in the same GUI:
xw=getappdata(handles.xw(1),’xw’);
xe=getappdata(handles.xe(1),’xe’);
nx=getappdata(handles.nx(1),’nx’);
typex=getappdata(handles.typex(1),’typex’);
%Choix du programme de rafinement a executer
if(typex==1)
n=length(nx);
for i=1:n
xwt=xw(i);
xet=xe(i);
nxt=nx(i);
create_block_uniform_X(xwt, xet, nxt)
end
That does works.
But in an other function, I use that to retrieve the datas:
X=getappdata(0,’X’)
Y=getappdata(0,’Y’)
Z=getappdata(0,’Z’)
nx=getappdata(0,’nx’)
xw=getappdata(0,’xw’)
xe=getappdata(0,’xe’)
ny=getappdata(0,’ny’)
yw=getappdata(0,’yw’)
ye=getappdata(0,’ye’)
nz=getappdata(0,’nz’)
zw=getappdata(0,’zw’)
ze=getappdata(0,’ze’)
The thing is that for X,Y,Z it does retrieve the datas (X, Y, Z are the outputs arguments from the previous fonction ‘create_block_uniform’) but that return empty arrays for the others… I don’t understand
Z =
Columns 1 through 13
0 1.1111 2.2222 3.3333 4.4444 5.5556 6.6667 7.7778 8.8889 10.0000 0 0 0
Columns 14 through 18
0 0 0 0 0
nx =
[]
xw =
[]
xe =
[]
Could someone help me ?
Thanks ! Hello everyone !
I have several GUI windows to collect parameters and I want to use them in functions.
The problem is, I store datas from edit text boxes into arrays like that :
typex=getappdata(hObject,’typex’);
typex(end+1)=str2double(handles.typex(1).String);
handles.typex(1).String=sprintf(‘block %d’,numel(typex)+1);
disp(typex)
setappdata(hObject,’typex’,typex);
assignin(‘base’,’typex’,typex);
Then, in a callback I use them in the same GUI:
xw=getappdata(handles.xw(1),’xw’);
xe=getappdata(handles.xe(1),’xe’);
nx=getappdata(handles.nx(1),’nx’);
typex=getappdata(handles.typex(1),’typex’);
%Choix du programme de rafinement a executer
if(typex==1)
n=length(nx);
for i=1:n
xwt=xw(i);
xet=xe(i);
nxt=nx(i);
create_block_uniform_X(xwt, xet, nxt)
end
That does works.
But in an other function, I use that to retrieve the datas:
X=getappdata(0,’X’)
Y=getappdata(0,’Y’)
Z=getappdata(0,’Z’)
nx=getappdata(0,’nx’)
xw=getappdata(0,’xw’)
xe=getappdata(0,’xe’)
ny=getappdata(0,’ny’)
yw=getappdata(0,’yw’)
ye=getappdata(0,’ye’)
nz=getappdata(0,’nz’)
zw=getappdata(0,’zw’)
ze=getappdata(0,’ze’)
The thing is that for X,Y,Z it does retrieve the datas (X, Y, Z are the outputs arguments from the previous fonction ‘create_block_uniform’) but that return empty arrays for the others… I don’t understand
Z =
Columns 1 through 13
0 1.1111 2.2222 3.3333 4.4444 5.5556 6.6667 7.7778 8.8889 10.0000 0 0 0
Columns 14 through 18
0 0 0 0 0
nx =
[]
xw =
[]
xe =
[]
Could someone help me ?
Thanks ! store data MATLAB Answers — New Questions
Login problems with Matlab 2024a
I keep receiving the message "Unable to save login information. You are currently signed in but you will be prompted to sign in again the next time that you start this application." everytime I start the Matlab application.
I tried to follow all the steps I could find, such as reinstaling the Mathworks Service Host, eliminating the files at ‘%APPDATA%MathWorkscredentials’, ‘%APPDATA%RoamingMathWorksMATLAB’, reinstaling the Matlab 2024a. I don’t know what else to do in order to fix this problem.
Can you help me?I keep receiving the message "Unable to save login information. You are currently signed in but you will be prompted to sign in again the next time that you start this application." everytime I start the Matlab application.
I tried to follow all the steps I could find, such as reinstaling the Mathworks Service Host, eliminating the files at ‘%APPDATA%MathWorkscredentials’, ‘%APPDATA%RoamingMathWorksMATLAB’, reinstaling the Matlab 2024a. I don’t know what else to do in order to fix this problem.
Can you help me? I keep receiving the message "Unable to save login information. You are currently signed in but you will be prompted to sign in again the next time that you start this application." everytime I start the Matlab application.
I tried to follow all the steps I could find, such as reinstaling the Mathworks Service Host, eliminating the files at ‘%APPDATA%MathWorkscredentials’, ‘%APPDATA%RoamingMathWorksMATLAB’, reinstaling the Matlab 2024a. I don’t know what else to do in order to fix this problem.
Can you help me? login, r2024a, credentials MATLAB Answers — New Questions
Error in data size using CIC filter in Simulink R2020b: The number of input rows must be a multiple of the decimation factor
I am trying a simple Simulink model of an NCO generating a sin and cos which I then use in their own respective CIC decimator to generate quad and real output signals.
In the two product blocks (X) I get an error "The number of input rows must be a multiple of the decimation factor". I tried adding the convert blocks and specifying output type fixdt(1,20,18), but that didn’t help. The NCO is generating the proper sin and cos with amplitude +/-1 and frequency 13.5MHz with a 256Mhz sample rate.
What is the trick to getting the CIC to work? I looked at a similar Matlab Example for a GSM dds and it worked, but there was nothing special done (that I could see) to make the CIC input data types correct. Please help, I’ve spent a day chasing this problem :(I am trying a simple Simulink model of an NCO generating a sin and cos which I then use in their own respective CIC decimator to generate quad and real output signals.
In the two product blocks (X) I get an error "The number of input rows must be a multiple of the decimation factor". I tried adding the convert blocks and specifying output type fixdt(1,20,18), but that didn’t help. The NCO is generating the proper sin and cos with amplitude +/-1 and frequency 13.5MHz with a 256Mhz sample rate.
What is the trick to getting the CIC to work? I looked at a similar Matlab Example for a GSM dds and it worked, but there was nothing special done (that I could see) to make the CIC input data types correct. Please help, I’ve spent a day chasing this problem 🙁 I am trying a simple Simulink model of an NCO generating a sin and cos which I then use in their own respective CIC decimator to generate quad and real output signals.
In the two product blocks (X) I get an error "The number of input rows must be a multiple of the decimation factor". I tried adding the convert blocks and specifying output type fixdt(1,20,18), but that didn’t help. The NCO is generating the proper sin and cos with amplitude +/-1 and frequency 13.5MHz with a 256Mhz sample rate.
What is the trick to getting the CIC to work? I looked at a similar Matlab Example for a GSM dds and it worked, but there was nothing special done (that I could see) to make the CIC input data types correct. Please help, I’ve spent a day chasing this problem 🙁 #cic, #simulink MATLAB Answers — New Questions
Slicing arrays and save it in the file
Hello,
I have a file of the following form:
data condition device
-297.367190000000 8 1
-295.132890000000 8 1
-268.007000000000 8 2
-268.007000000000 8 2
-262.109380000000 7 1
-263.296880000000 7 1
-263.562500000000 7 2
-263.562500000000 7 2
-258.973210000000 6 1
-255.209820000000 6 1
-255.209820000000 6 2
-255.209820000000 6 2
I would like to process the data being a slice of array for the given condition and device for instance one slice would be:
-297.367190000000 8 1
-295.132890000000 8 1
and save the result in file with the following format for instance for the data above:
dataProcessed_condition8_device1
How could I cut such slice and save it in the file of the described format?
Regards
ElzbietaHello,
I have a file of the following form:
data condition device
-297.367190000000 8 1
-295.132890000000 8 1
-268.007000000000 8 2
-268.007000000000 8 2
-262.109380000000 7 1
-263.296880000000 7 1
-263.562500000000 7 2
-263.562500000000 7 2
-258.973210000000 6 1
-255.209820000000 6 1
-255.209820000000 6 2
-255.209820000000 6 2
I would like to process the data being a slice of array for the given condition and device for instance one slice would be:
-297.367190000000 8 1
-295.132890000000 8 1
and save the result in file with the following format for instance for the data above:
dataProcessed_condition8_device1
How could I cut such slice and save it in the file of the described format?
Regards
Elzbieta Hello,
I have a file of the following form:
data condition device
-297.367190000000 8 1
-295.132890000000 8 1
-268.007000000000 8 2
-268.007000000000 8 2
-262.109380000000 7 1
-263.296880000000 7 1
-263.562500000000 7 2
-263.562500000000 7 2
-258.973210000000 6 1
-255.209820000000 6 1
-255.209820000000 6 2
-255.209820000000 6 2
I would like to process the data being a slice of array for the given condition and device for instance one slice would be:
-297.367190000000 8 1
-295.132890000000 8 1
and save the result in file with the following format for instance for the data above:
dataProcessed_condition8_device1
How could I cut such slice and save it in the file of the described format?
Regards
Elzbieta slice array MATLAB Answers — New Questions
Error message when using timers in AppDesigner after a few seconds running
I’m quite new to using timers in Matlab, and currently I’m running a project that will need them to continuously update some info in our App Designer window. The problem is, I followed the instructions in this tutorial from Matlab and initially my timer and callback function work normally. But after some time of it running I receive the following error message:
Error while evaluating TimerFcn for timer ‘timer-1’
Not enough input arguments.
I currently initialize my timer in the startupFcn of the app as:
function startupFcn(app)
global params
app.textbox_Log.Value = {‘Start’};
app.timerCounter1sec = 0;
app.timerCounter10sec = 0;
app.logStatus = ‘running’;
app.timer500ms = timer(‘Period’,0.5,…
‘ExecutionMode’, ‘fixedSpacing’, …
‘TasksToExecute’, Inf, …
‘BusyMode’, ‘drop’, …
‘TimerFcn’, @app.timerTest);
start(app.timer500ms);
updateJobList(app, params);
fillJobsTable(app, params);
end
And my callback function is defined as the following (I will omit the code for now since I don’t think it’s that important right now):
function timerTest(app,~,~)
% Function details…
end
Can someone help me with this? I have no clue of what is happening to throw this error in the timer, even considering that it works for around 3-4 seconds before breaking.I’m quite new to using timers in Matlab, and currently I’m running a project that will need them to continuously update some info in our App Designer window. The problem is, I followed the instructions in this tutorial from Matlab and initially my timer and callback function work normally. But after some time of it running I receive the following error message:
Error while evaluating TimerFcn for timer ‘timer-1’
Not enough input arguments.
I currently initialize my timer in the startupFcn of the app as:
function startupFcn(app)
global params
app.textbox_Log.Value = {‘Start’};
app.timerCounter1sec = 0;
app.timerCounter10sec = 0;
app.logStatus = ‘running’;
app.timer500ms = timer(‘Period’,0.5,…
‘ExecutionMode’, ‘fixedSpacing’, …
‘TasksToExecute’, Inf, …
‘BusyMode’, ‘drop’, …
‘TimerFcn’, @app.timerTest);
start(app.timer500ms);
updateJobList(app, params);
fillJobsTable(app, params);
end
And my callback function is defined as the following (I will omit the code for now since I don’t think it’s that important right now):
function timerTest(app,~,~)
% Function details…
end
Can someone help me with this? I have no clue of what is happening to throw this error in the timer, even considering that it works for around 3-4 seconds before breaking. I’m quite new to using timers in Matlab, and currently I’m running a project that will need them to continuously update some info in our App Designer window. The problem is, I followed the instructions in this tutorial from Matlab and initially my timer and callback function work normally. But after some time of it running I receive the following error message:
Error while evaluating TimerFcn for timer ‘timer-1’
Not enough input arguments.
I currently initialize my timer in the startupFcn of the app as:
function startupFcn(app)
global params
app.textbox_Log.Value = {‘Start’};
app.timerCounter1sec = 0;
app.timerCounter10sec = 0;
app.logStatus = ‘running’;
app.timer500ms = timer(‘Period’,0.5,…
‘ExecutionMode’, ‘fixedSpacing’, …
‘TasksToExecute’, Inf, …
‘BusyMode’, ‘drop’, …
‘TimerFcn’, @app.timerTest);
start(app.timer500ms);
updateJobList(app, params);
fillJobsTable(app, params);
end
And my callback function is defined as the following (I will omit the code for now since I don’t think it’s that important right now):
function timerTest(app,~,~)
% Function details…
end
Can someone help me with this? I have no clue of what is happening to throw this error in the timer, even considering that it works for around 3-4 seconds before breaking. timer, appdesigner, app designer, handles, error, input argument MATLAB Answers — New Questions
Problem with Fast Restart and Simulink Scenario Reader
Hello everyone,
I’m trying to train an RL agent on a vehicle to brake when encountering a pedestrian. I have set up a scenario using the driving scenario toolbox and everything in simulink to make it work.
I just have one problem: I’d like to randomize the pedestrian’s position, so I created a random function in the scenario definition script, but when I use fast restart the scenario reader gets stuck on the first simulation scenario. If I don’t, Simulink recompiles and everything works.
Is there a way to not disable fast restart, but still completely restart the scenario with variations?Hello everyone,
I’m trying to train an RL agent on a vehicle to brake when encountering a pedestrian. I have set up a scenario using the driving scenario toolbox and everything in simulink to make it work.
I just have one problem: I’d like to randomize the pedestrian’s position, so I created a random function in the scenario definition script, but when I use fast restart the scenario reader gets stuck on the first simulation scenario. If I don’t, Simulink recompiles and everything works.
Is there a way to not disable fast restart, but still completely restart the scenario with variations? Hello everyone,
I’m trying to train an RL agent on a vehicle to brake when encountering a pedestrian. I have set up a scenario using the driving scenario toolbox and everything in simulink to make it work.
I just have one problem: I’d like to randomize the pedestrian’s position, so I created a random function in the scenario definition script, but when I use fast restart the scenario reader gets stuck on the first simulation scenario. If I don’t, Simulink recompiles and everything works.
Is there a way to not disable fast restart, but still completely restart the scenario with variations? fast restart, driving scenario, reinforcement learning toolbox, reset scenario MATLAB Answers — New Questions
I want to plot RMSE from mat file but it gives error
When I run the m file, it gives me he following error:
Operator ‘-‘ is not supported for operands of type ‘cell’.
Error in RMSE_Plot (line 5)
MSE = mean((u-two).^2,2);
>>When I run the m file, it gives me he following error:
Operator ‘-‘ is not supported for operands of type ‘cell’.
Error in RMSE_Plot (line 5)
MSE = mean((u-two).^2,2);
>> When I run the m file, it gives me he following error:
Operator ‘-‘ is not supported for operands of type ‘cell’.
Error in RMSE_Plot (line 5)
MSE = mean((u-two).^2,2);
>> code gives error, rmse error, plotting, mat file MATLAB Answers — New Questions