Category: News
Extracting values from optimization variable and setting constraints
I have a basket of 20 products with baseline quantities E.g., 40 Tomatoes, 15 Onions, 35 Apples etc. Standard linear optimization with the objective being maximizing the value of the basket subject to constraints on the total weight of the basket, total number of items etc.
The optimization variable QTY is used by the optimizer to adjust the baseline quantity for each product. QTY can take integer values of -15 to +15, i.e., it can increase or reduce baseline amounts of each product by 5 units.
For reasons outside the scope of this question, I need to limit the total number of adjustments it makes across all products, i.e., the sum of the absolute value of QTY <= 30. So it can’t reduce Tomatoes and Onions by 10 each but increase Apples by 15.
How do I place this constraint?
The ABS function can’t access the values in QTY. Adding the constraint on the squared value of QTY gives me a "nonlinear problem" error. Assigning values in QTY to another variable doesn’t work since it just aliases. Various other attempts have yielded the same "nonlinear" error. I’ve been able to make it work in the past by setting 2 optimization variables – QTYUP and QTYDOWN but that becomes clunky.
Current thought is to find a way to extract the values in QTY into a temporary variable, calculate the sum of absolute values, and go. But I haven’t found a straightforward way to this.
Thanks.I have a basket of 20 products with baseline quantities E.g., 40 Tomatoes, 15 Onions, 35 Apples etc. Standard linear optimization with the objective being maximizing the value of the basket subject to constraints on the total weight of the basket, total number of items etc.
The optimization variable QTY is used by the optimizer to adjust the baseline quantity for each product. QTY can take integer values of -15 to +15, i.e., it can increase or reduce baseline amounts of each product by 5 units.
For reasons outside the scope of this question, I need to limit the total number of adjustments it makes across all products, i.e., the sum of the absolute value of QTY <= 30. So it can’t reduce Tomatoes and Onions by 10 each but increase Apples by 15.
How do I place this constraint?
The ABS function can’t access the values in QTY. Adding the constraint on the squared value of QTY gives me a "nonlinear problem" error. Assigning values in QTY to another variable doesn’t work since it just aliases. Various other attempts have yielded the same "nonlinear" error. I’ve been able to make it work in the past by setting 2 optimization variables – QTYUP and QTYDOWN but that becomes clunky.
Current thought is to find a way to extract the values in QTY into a temporary variable, calculate the sum of absolute values, and go. But I haven’t found a straightforward way to this.
Thanks. I have a basket of 20 products with baseline quantities E.g., 40 Tomatoes, 15 Onions, 35 Apples etc. Standard linear optimization with the objective being maximizing the value of the basket subject to constraints on the total weight of the basket, total number of items etc.
The optimization variable QTY is used by the optimizer to adjust the baseline quantity for each product. QTY can take integer values of -15 to +15, i.e., it can increase or reduce baseline amounts of each product by 5 units.
For reasons outside the scope of this question, I need to limit the total number of adjustments it makes across all products, i.e., the sum of the absolute value of QTY <= 30. So it can’t reduce Tomatoes and Onions by 10 each but increase Apples by 15.
How do I place this constraint?
The ABS function can’t access the values in QTY. Adding the constraint on the squared value of QTY gives me a "nonlinear problem" error. Assigning values in QTY to another variable doesn’t work since it just aliases. Various other attempts have yielded the same "nonlinear" error. I’ve been able to make it work in the past by setting 2 optimization variables – QTYUP and QTYDOWN but that becomes clunky.
Current thought is to find a way to extract the values in QTY into a temporary variable, calculate the sum of absolute values, and go. But I haven’t found a straightforward way to this.
Thanks. optimization, constraints MATLAB Answers — New Questions
command not found: pip
Python is installed and loaded in Matlab but pip is not found
how can I fix this?
>> pyenv
ans =
PythonEnvironment with properties:
Version: "3.9"
Executable: "/Library/Developer/CommandLineTools/usr/bin/python3"
Library: "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/libpython3.9.dylib"
Home: "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9"
Status: Loaded
ExecutionMode: InProcess
ProcessID: "17092"
ProcessName: "MATLAB"
>> !pip install tensorflow
zsh:1: command not found: pipPython is installed and loaded in Matlab but pip is not found
how can I fix this?
>> pyenv
ans =
PythonEnvironment with properties:
Version: "3.9"
Executable: "/Library/Developer/CommandLineTools/usr/bin/python3"
Library: "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/libpython3.9.dylib"
Home: "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9"
Status: Loaded
ExecutionMode: InProcess
ProcessID: "17092"
ProcessName: "MATLAB"
>> !pip install tensorflow
zsh:1: command not found: pip Python is installed and loaded in Matlab but pip is not found
how can I fix this?
>> pyenv
ans =
PythonEnvironment with properties:
Version: "3.9"
Executable: "/Library/Developer/CommandLineTools/usr/bin/python3"
Library: "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/libpython3.9.dylib"
Home: "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9"
Status: Loaded
ExecutionMode: InProcess
ProcessID: "17092"
ProcessName: "MATLAB"
>> !pip install tensorflow
zsh:1: command not found: pip python MATLAB Answers — New Questions
Designing Coffee vending Machine using Simulink MATLAB
I am trying to build a coffee vending machine in the simulink for MATLAB but I can’t find any resoruces related to the topic can anyone help me.I am trying to build a coffee vending machine in the simulink for MATLAB but I can’t find any resoruces related to the topic can anyone help me. I am trying to build a coffee vending machine in the simulink for MATLAB but I can’t find any resoruces related to the topic can anyone help me. simulink, matlab MATLAB Answers — New Questions
Readtable is not reading all of my Data
I am trying to use readtable to read a large excel file (5185 rows) and sometimes this excel file will have columns 21 & 22 empty other then the title up until the 3000+ lines. When this is the case the entire column of 21 & 22 has <missing> as its variable. I assume that after a certain amount of rows the readtable just assumes that the rest of the column is empty. For example, when there are values stored in those columns starting at row 148 it will properly read the data and <missing> does not come up anywhere. Does anyone know a way that can bypass this assumption?
This is the code I am using to read the excel data:
FileName_excel_Results = sprintf(‘SmartChipData_A%06i%s_Results.xlsx’, app.ChipIDEditField.Value, app.dropdown.Value);
fullFileName_excel_Results = fullfile(app.result_filepath, FileName_excel_Results);
t = readtable(fullFileName_excel_Results, ‘Sheet’,’Summary’,’ExpectedNumVariables’,23); % storing the Selected_Spots excel
summary = table2cell(t);
disp(string(summary(3196,:)));
Here is the output I get from the Disp:
Columns 1 through 7
"3195" "45" "28" "45" "C:UsersSingle C…" "C:UsersSingle C…" "[0,0,0]"
Columns 8 through 17
"45/28" "0" "0" "1" "-1" "-1" "-1" "Auto" "A" "i7-28"
Columns 18 through 23
"CGATAACTGGTCTTAAG…" "i5-45" "TAAAGTAGTAAAGTAGG…" <missing> <missing> "47"
This is what is stored in that row from the excel sheet:
3195 45 28 45 C:UsersSingle Cell ScopeDesktopChip143881CyanS0000C45R45_C45_0000_00_Cyan.tif C:UsersSingle Cell ScopeDesktopChip143881GreenS0000C45R45_C45_0000_01_Green.tif [0,0,0] 45/28 0 0 1 -1 -1-1 Auto A i7-28 CGATAACTGGTCTTAAGATGTGAA i5-45 TAAAGTAGTAAAGTAGGATTCTCT C1 1A1 47I am trying to use readtable to read a large excel file (5185 rows) and sometimes this excel file will have columns 21 & 22 empty other then the title up until the 3000+ lines. When this is the case the entire column of 21 & 22 has <missing> as its variable. I assume that after a certain amount of rows the readtable just assumes that the rest of the column is empty. For example, when there are values stored in those columns starting at row 148 it will properly read the data and <missing> does not come up anywhere. Does anyone know a way that can bypass this assumption?
This is the code I am using to read the excel data:
FileName_excel_Results = sprintf(‘SmartChipData_A%06i%s_Results.xlsx’, app.ChipIDEditField.Value, app.dropdown.Value);
fullFileName_excel_Results = fullfile(app.result_filepath, FileName_excel_Results);
t = readtable(fullFileName_excel_Results, ‘Sheet’,’Summary’,’ExpectedNumVariables’,23); % storing the Selected_Spots excel
summary = table2cell(t);
disp(string(summary(3196,:)));
Here is the output I get from the Disp:
Columns 1 through 7
"3195" "45" "28" "45" "C:UsersSingle C…" "C:UsersSingle C…" "[0,0,0]"
Columns 8 through 17
"45/28" "0" "0" "1" "-1" "-1" "-1" "Auto" "A" "i7-28"
Columns 18 through 23
"CGATAACTGGTCTTAAG…" "i5-45" "TAAAGTAGTAAAGTAGG…" <missing> <missing> "47"
This is what is stored in that row from the excel sheet:
3195 45 28 45 C:UsersSingle Cell ScopeDesktopChip143881CyanS0000C45R45_C45_0000_00_Cyan.tif C:UsersSingle Cell ScopeDesktopChip143881GreenS0000C45R45_C45_0000_01_Green.tif [0,0,0] 45/28 0 0 1 -1 -1-1 Auto A i7-28 CGATAACTGGTCTTAAGATGTGAA i5-45 TAAAGTAGTAAAGTAGGATTCTCT C1 1A1 47 I am trying to use readtable to read a large excel file (5185 rows) and sometimes this excel file will have columns 21 & 22 empty other then the title up until the 3000+ lines. When this is the case the entire column of 21 & 22 has <missing> as its variable. I assume that after a certain amount of rows the readtable just assumes that the rest of the column is empty. For example, when there are values stored in those columns starting at row 148 it will properly read the data and <missing> does not come up anywhere. Does anyone know a way that can bypass this assumption?
This is the code I am using to read the excel data:
FileName_excel_Results = sprintf(‘SmartChipData_A%06i%s_Results.xlsx’, app.ChipIDEditField.Value, app.dropdown.Value);
fullFileName_excel_Results = fullfile(app.result_filepath, FileName_excel_Results);
t = readtable(fullFileName_excel_Results, ‘Sheet’,’Summary’,’ExpectedNumVariables’,23); % storing the Selected_Spots excel
summary = table2cell(t);
disp(string(summary(3196,:)));
Here is the output I get from the Disp:
Columns 1 through 7
"3195" "45" "28" "45" "C:UsersSingle C…" "C:UsersSingle C…" "[0,0,0]"
Columns 8 through 17
"45/28" "0" "0" "1" "-1" "-1" "-1" "Auto" "A" "i7-28"
Columns 18 through 23
"CGATAACTGGTCTTAAG…" "i5-45" "TAAAGTAGTAAAGTAGG…" <missing> <missing> "47"
This is what is stored in that row from the excel sheet:
3195 45 28 45 C:UsersSingle Cell ScopeDesktopChip143881CyanS0000C45R45_C45_0000_00_Cyan.tif C:UsersSingle Cell ScopeDesktopChip143881GreenS0000C45R45_C45_0000_01_Green.tif [0,0,0] 45/28 0 0 1 -1 -1-1 Auto A i7-28 CGATAACTGGTCTTAAGATGTGAA i5-45 TAAAGTAGTAAAGTAGGATTCTCT C1 1A1 47 importing excel data, data import MATLAB Answers — New Questions
Obtaining the proportional, derivative and integral gains from a specific settling time and overshoot inputted using a Simulink block diagram
I need to find the PID gains that are obtained from a 10% overshoot and a 10 second settling time from the block diagram system attached. every resource I use online points me to PID Tuner App and it doesn’t seem to have a tool which can set the overshoot and settling time to specific values and I have been running into a lot of issuesI need to find the PID gains that are obtained from a 10% overshoot and a 10 second settling time from the block diagram system attached. every resource I use online points me to PID Tuner App and it doesn’t seem to have a tool which can set the overshoot and settling time to specific values and I have been running into a lot of issues I need to find the PID gains that are obtained from a 10% overshoot and a 10 second settling time from the block diagram system attached. every resource I use online points me to PID Tuner App and it doesn’t seem to have a tool which can set the overshoot and settling time to specific values and I have been running into a lot of issues pid control, simulink MATLAB Answers — New Questions
Having issues writing matrix to a binary file.
For example,
A = [ 0.1712 0.2769 0.8235
0.7060 0.0462 0.6948
0.0318 0.0971 0.3171]
file1 = ‘mat1.dat’
fileID = fopen(file1, ‘w’);
fwrite(fileID, size(data1), ‘int32’);
fwrite(fileID, data1, ‘double’)
fclose("all")
Using this code, the matrix size remains the same, but when I read it, the last row gets messed up, for example, see the output below:
0.0000 0.0318 0.0971
0.1712 0.2769 0.8235
0.7060 0.0462 0.6948
>> Anyone knows how to fix this?For example,
A = [ 0.1712 0.2769 0.8235
0.7060 0.0462 0.6948
0.0318 0.0971 0.3171]
file1 = ‘mat1.dat’
fileID = fopen(file1, ‘w’);
fwrite(fileID, size(data1), ‘int32’);
fwrite(fileID, data1, ‘double’)
fclose("all")
Using this code, the matrix size remains the same, but when I read it, the last row gets messed up, for example, see the output below:
0.0000 0.0318 0.0971
0.1712 0.2769 0.8235
0.7060 0.0462 0.6948
>> Anyone knows how to fix this? For example,
A = [ 0.1712 0.2769 0.8235
0.7060 0.0462 0.6948
0.0318 0.0971 0.3171]
file1 = ‘mat1.dat’
fileID = fopen(file1, ‘w’);
fwrite(fileID, size(data1), ‘int32’);
fwrite(fileID, data1, ‘double’)
fclose("all")
Using this code, the matrix size remains the same, but when I read it, the last row gets messed up, for example, see the output below:
0.0000 0.0318 0.0971
0.1712 0.2769 0.8235
0.7060 0.0462 0.6948
>> Anyone knows how to fix this? binary, matrix, fread, fwrite MATLAB Answers — New Questions
How can I move an object in Simscape Multibody in 6DOF with position inputs?
I have a project which I need to simulate an UAV in Simscape Multibody environment. I used "6-DOF Joint" block for this purpose however,I can use position inputs for only translational motion. For rotational motion there is only one actuation option which is torque. I want to provide the angles directly. Is there a way to do that?I have a project which I need to simulate an UAV in Simscape Multibody environment. I used "6-DOF Joint" block for this purpose however,I can use position inputs for only translational motion. For rotational motion there is only one actuation option which is torque. I want to provide the angles directly. Is there a way to do that? I have a project which I need to simulate an UAV in Simscape Multibody environment. I used "6-DOF Joint" block for this purpose however,I can use position inputs for only translational motion. For rotational motion there is only one actuation option which is torque. I want to provide the angles directly. Is there a way to do that? simscape, multibody MATLAB Answers — New Questions
does anyone have matlab code for routing of underwater wireless sensor networks?
I am finding the codes for any routing protocol of underwater wsn for my m.tech thesis.I am finding the codes for any routing protocol of underwater wsn for my m.tech thesis. I am finding the codes for any routing protocol of underwater wsn for my m.tech thesis. matlab MATLAB Answers — New Questions
I want to graph a voltage and current of each of my elements. please help me
Post Content Post Content electrical networks MATLAB Answers — New Questions
what type of error is this? is this the logical error, simulation error, code error?
what type of error is this? is this the logical error, simulation error, code error?what type of error is this? is this the logical error, simulation error, code error? what type of error is this? is this the logical error, simulation error, code error? what type of error is this? is this the logical er MATLAB Answers — New Questions
Access to Matlab 2018a version?
Hey guys, I’m trying to run code that someone else wrote on the 2018a version of Matlab. It won’t run on the 2022 version on my PC. Does anyone know of a safe website to download the 2018a version of Matlab? I’m hoping this will solve the problem. Thanks.Hey guys, I’m trying to run code that someone else wrote on the 2018a version of Matlab. It won’t run on the 2022 version on my PC. Does anyone know of a safe website to download the 2018a version of Matlab? I’m hoping this will solve the problem. Thanks. Hey guys, I’m trying to run code that someone else wrote on the 2018a version of Matlab. It won’t run on the 2022 version on my PC. Does anyone know of a safe website to download the 2018a version of Matlab? I’m hoping this will solve the problem. Thanks. matlab 2018a MATLAB Answers — New Questions
Outlook Editor doesn’t save multiple languages
When adding multiple languages in Outlook’s Editor (web), it doesn’t save them when closing the browser. It only leaves the default one.
It’s frustrating since I have to manually add again those languages every time I open the browser.
As a side note, I’m not logging off from my Microsoft account, just closing the browser.
When adding multiple languages in Outlook’s Editor (web), it doesn’t save them when closing the browser. It only leaves the default one.It’s frustrating since I have to manually add again those languages every time I open the browser. As a side note, I’m not logging off from my Microsoft account, just closing the browser. Read More
Can’t identify hadoop home from Matlab to use Matlab Parallel Toolbox.
I have Matlab2014b + Hadoop installed. The hadoop works well on my CentOS Linux system.
I run the mablab on that CentOS Linux machine. With the commands as follows.
It shows the folder is not a valid Hadop no matter how to change it ( I tried set the directory with hadoop 1.2.1, hadoop 2.5.2, hadoop cloudera distribution; also tried with parameter HADOOP_PREFIX,HADOOP_HOME,MATLAB_HADOOP_INSTALL ).
Anything else I can do to fix this error ?
>> setenv(‘MATLAB_HADOOP_INSTALL’,’/mnt/disk1/data/soft/hadoop-2.5.2′);
>> cluster = parallel.cluster.Hadoop;
Error using parallel.cluster.Hadoop (line 107)
Unable to recognize ‘/mnt/disk1/data/soft/hadoop-2.5.2’ as a valid HADOOP
installation folder. Check that this is the root of your HADOOP installation
folder.
Thanks and Best Wishes.
XinsongI have Matlab2014b + Hadoop installed. The hadoop works well on my CentOS Linux system.
I run the mablab on that CentOS Linux machine. With the commands as follows.
It shows the folder is not a valid Hadop no matter how to change it ( I tried set the directory with hadoop 1.2.1, hadoop 2.5.2, hadoop cloudera distribution; also tried with parameter HADOOP_PREFIX,HADOOP_HOME,MATLAB_HADOOP_INSTALL ).
Anything else I can do to fix this error ?
>> setenv(‘MATLAB_HADOOP_INSTALL’,’/mnt/disk1/data/soft/hadoop-2.5.2′);
>> cluster = parallel.cluster.Hadoop;
Error using parallel.cluster.Hadoop (line 107)
Unable to recognize ‘/mnt/disk1/data/soft/hadoop-2.5.2’ as a valid HADOOP
installation folder. Check that this is the root of your HADOOP installation
folder.
Thanks and Best Wishes.
Xinsong I have Matlab2014b + Hadoop installed. The hadoop works well on my CentOS Linux system.
I run the mablab on that CentOS Linux machine. With the commands as follows.
It shows the folder is not a valid Hadop no matter how to change it ( I tried set the directory with hadoop 1.2.1, hadoop 2.5.2, hadoop cloudera distribution; also tried with parameter HADOOP_PREFIX,HADOOP_HOME,MATLAB_HADOOP_INSTALL ).
Anything else I can do to fix this error ?
>> setenv(‘MATLAB_HADOOP_INSTALL’,’/mnt/disk1/data/soft/hadoop-2.5.2′);
>> cluster = parallel.cluster.Hadoop;
Error using parallel.cluster.Hadoop (line 107)
Unable to recognize ‘/mnt/disk1/data/soft/hadoop-2.5.2’ as a valid HADOOP
installation folder. Check that this is the root of your HADOOP installation
folder.
Thanks and Best Wishes.
Xinsong hadoop, parallel computing tool, hadoop_home, linux MATLAB Answers — New Questions
Office 365 Licenses
We earlier had E3 license.
Basically what happened was when the E5 license was activated on the tenant, we thought the e5 functionality applied only to the users that were specifically assigned an e5 license. This causes 1000’s of emails to either be sent to quarantine or be Zapped(completely deleted) by the Zero Day Auto Purge
Is there any way so that the E5 functionality is only limited to the users whom are assigned E5 license and not the users who are assigned other licenses.
If a tenant has 10 E5 licenses and 90 E3 licenses
Does this make us non complaint for licenses.
Dies it mean that we need to upgrade all E3 licenses to E5 or can our tenant have a mix of E5 and E3 license.
Meaning do they need to upgrade all the E3 licenses to E5 for Microsoft compliance, or can the tenant be mixed with both E5 and E3 licenses and be within compliance?
As of now , we are checking and disabled the configuration to send emails to Quarantine however for some users emails are being sent to restore folder.
When we check the MS logs ,it shows that the actions are performed by users from outlook however the users did not take any action
We earlier had E3 license.Basically what happened was when the E5 license was activated on the tenant, we thought the e5 functionality applied only to the users that were specifically assigned an e5 license. This causes 1000’s of emails to either be sent to quarantine or be Zapped(completely deleted) by the Zero Day Auto PurgeIs there any way so that the E5 functionality is only limited to the users whom are assigned E5 license and not the users who are assigned other licenses.If a tenant has 10 E5 licenses and 90 E3 licensesDoes this make us non complaint for licenses.Dies it mean that we need to upgrade all E3 licenses to E5 or can our tenant have a mix of E5 and E3 license.Meaning do they need to upgrade all the E3 licenses to E5 for Microsoft compliance, or can the tenant be mixed with both E5 and E3 licenses and be within compliance?As of now , we are checking and disabled the configuration to send emails to Quarantine however for some users emails are being sent to restore folder.When we check the MS logs ,it shows that the actions are performed by users from outlook however the users did not take any action Read More
uigetfile Multiselect option not working for single file select
I have been trying to figure out why you can’t select a single file, if you have the ‘MultiSelect’ option set to ‘on’ in the uigetfile command. I need to be able to select ‘one or more’ files. Here is the code:
% Select and Open file
[files, pathname] = uigetfile({‘*.xls*’; ‘*.csv’}, …
‘Select One or More Files’, ‘MultiSelect’, ‘on’);
for filecount = 1:length(files)
filename = convertCharsToStrings(files(filecount));
opts = detectImportOptions(filename, VariableNamingRule="modify");
MDRdata = readtable(filename, opts);
time = datetime(MDRdata.ZuluDate_Time,"InputFormat",’yyyy-MM-dd”T”HH:mm:ss.SSS”Z’);
time.Format = ‘HH:mm:ss.SSS’;
….
I keep getting the following:
"Error using detectImportOptions
Unable to find or open ‘1’. Check the path and filename or file permissions.
Error in ApacheMDRProgram_04162024 (line 12)
opts = detectImportOptions(filename, VariableNamingRule="modify");"
It works fine if you select more than one file.I have been trying to figure out why you can’t select a single file, if you have the ‘MultiSelect’ option set to ‘on’ in the uigetfile command. I need to be able to select ‘one or more’ files. Here is the code:
% Select and Open file
[files, pathname] = uigetfile({‘*.xls*’; ‘*.csv’}, …
‘Select One or More Files’, ‘MultiSelect’, ‘on’);
for filecount = 1:length(files)
filename = convertCharsToStrings(files(filecount));
opts = detectImportOptions(filename, VariableNamingRule="modify");
MDRdata = readtable(filename, opts);
time = datetime(MDRdata.ZuluDate_Time,"InputFormat",’yyyy-MM-dd”T”HH:mm:ss.SSS”Z’);
time.Format = ‘HH:mm:ss.SSS’;
….
I keep getting the following:
"Error using detectImportOptions
Unable to find or open ‘1’. Check the path and filename or file permissions.
Error in ApacheMDRProgram_04162024 (line 12)
opts = detectImportOptions(filename, VariableNamingRule="modify");"
It works fine if you select more than one file. I have been trying to figure out why you can’t select a single file, if you have the ‘MultiSelect’ option set to ‘on’ in the uigetfile command. I need to be able to select ‘one or more’ files. Here is the code:
% Select and Open file
[files, pathname] = uigetfile({‘*.xls*’; ‘*.csv’}, …
‘Select One or More Files’, ‘MultiSelect’, ‘on’);
for filecount = 1:length(files)
filename = convertCharsToStrings(files(filecount));
opts = detectImportOptions(filename, VariableNamingRule="modify");
MDRdata = readtable(filename, opts);
time = datetime(MDRdata.ZuluDate_Time,"InputFormat",’yyyy-MM-dd”T”HH:mm:ss.SSS”Z’);
time.Format = ‘HH:mm:ss.SSS’;
….
I keep getting the following:
"Error using detectImportOptions
Unable to find or open ‘1’. Check the path and filename or file permissions.
Error in ApacheMDRProgram_04162024 (line 12)
opts = detectImportOptions(filename, VariableNamingRule="modify");"
It works fine if you select more than one file. transferred MATLAB Answers — New Questions
Update on Security Work Impacting M365 Tenants / Course Labs
Hi all,
You are likely aware of the ongoing security work at Microsoft that is impacting M365 tenants and therefore courses that use those tenants in their labs. This information was provided on the March TSP Community Call. I understand this is a frustrating experience that may be impacting your ability to deliver classes. A resolution to this is top priority at Microsoft.
I’ve attached an updated version of the FAQ that contains additional information on the current situation. My understanding is that significant progress is being made and we may soon have a resolution. I will keep you updated in this forum of any new developments.
Thank you for your patience and partnership.
Hi all,
You are likely aware of the ongoing security work at Microsoft that is impacting M365 tenants and therefore courses that use those tenants in their labs. This information was provided on the March TSP Community Call. I understand this is a frustrating experience that may be impacting your ability to deliver classes. A resolution to this is top priority at Microsoft.
I’ve attached an updated version of the FAQ that contains additional information on the current situation. My understanding is that significant progress is being made and we may soon have a resolution. I will keep you updated in this forum of any new developments.
Thank you for your patience and partnership.
Read More
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-15. – can’t find what the problem is
I keep getting this error, but I have no idea what’s causing it.
Using the step button brings up nothing until the very end when it tries to finish.
all of the X’s,Z’s,Y’s within Fd are 15×1 with positive integers
Any ideas as to what’s causing this?
Fd=zeros(cap, cap, cap,term); %here is the original matrix I created cap=15 and term=20
…
for tt=19:-1:1
for i=1:cap
for j=1:cap
for k=1:cap
… %for brevity’s sake I’ve ommitted some stuff here that doesn’t seem to be causing issues
Fd(i,j,k,tt)= b*(…
m1*(…
p(y(j),z1(k))*(n1*Fd(xp(i),zp(j),y(k),tt+1) + (1-n1)*Fd(xpp(i),zpp(j),y(k),tt+1))+…
(1-p(y(j),z1(k)))*(n2*Fd(xp(i),z1(j),yg(k),tt+1) + (1-n2)*Fd(xpp(i),z1(j),ygg(k),tt+1)))+…
(1-m1)*(…
p2(y(j),z2(k))*(n1*Fd(xp(i),zd(j),y(k),tt+1) + (1-n1)*Fd(xpp(i),zdd(j),y(k),tt+1))+…
(1-p2(y(j),z2(k)))*(n2*Fd(xp(i),z2(j),yg(k),tt+1) + (1-n2)*Fd(xpp(i),z2(j),ygg(k),tt+1))…
))+…
(1-b)*( …
m2*(…
p(y1(j),z(k))*(n1*Fd(xp(i),zg(j),y1(k),tt+1) + (1-n1)*Fd(xpp(i) ,zgg(j),y1(k),tt+1))+ …
(1-p(y1(j),z(k)))*(n2*Fd(xp(i),z(j),yp(k),tt+1) + (1-n2)*Fd(xpp(i) ,z(j),ypp(k),tt+1)))+ …
(1-m2)*(p(y2(j),z(k))*(n1*Fd(xp(i),zg(j),y2(k),tt+1) + (1-n1)*Fd(xpp(i),zgg(j),y2(k),tt+1))+…
(1-p(y2(j),z(k)))*(n2*Fd(xp(i),z(j),yd(k),tt+1) + (1-n2)*Fd(xpp(i),z(j),ydd(k),tt+1))));
If more code is required, I can certainly provideI keep getting this error, but I have no idea what’s causing it.
Using the step button brings up nothing until the very end when it tries to finish.
all of the X’s,Z’s,Y’s within Fd are 15×1 with positive integers
Any ideas as to what’s causing this?
Fd=zeros(cap, cap, cap,term); %here is the original matrix I created cap=15 and term=20
…
for tt=19:-1:1
for i=1:cap
for j=1:cap
for k=1:cap
… %for brevity’s sake I’ve ommitted some stuff here that doesn’t seem to be causing issues
Fd(i,j,k,tt)= b*(…
m1*(…
p(y(j),z1(k))*(n1*Fd(xp(i),zp(j),y(k),tt+1) + (1-n1)*Fd(xpp(i),zpp(j),y(k),tt+1))+…
(1-p(y(j),z1(k)))*(n2*Fd(xp(i),z1(j),yg(k),tt+1) + (1-n2)*Fd(xpp(i),z1(j),ygg(k),tt+1)))+…
(1-m1)*(…
p2(y(j),z2(k))*(n1*Fd(xp(i),zd(j),y(k),tt+1) + (1-n1)*Fd(xpp(i),zdd(j),y(k),tt+1))+…
(1-p2(y(j),z2(k)))*(n2*Fd(xp(i),z2(j),yg(k),tt+1) + (1-n2)*Fd(xpp(i),z2(j),ygg(k),tt+1))…
))+…
(1-b)*( …
m2*(…
p(y1(j),z(k))*(n1*Fd(xp(i),zg(j),y1(k),tt+1) + (1-n1)*Fd(xpp(i) ,zgg(j),y1(k),tt+1))+ …
(1-p(y1(j),z(k)))*(n2*Fd(xp(i),z(j),yp(k),tt+1) + (1-n2)*Fd(xpp(i) ,z(j),ypp(k),tt+1)))+ …
(1-m2)*(p(y2(j),z(k))*(n1*Fd(xp(i),zg(j),y2(k),tt+1) + (1-n1)*Fd(xpp(i),zgg(j),y2(k),tt+1))+…
(1-p(y2(j),z(k)))*(n2*Fd(xp(i),z(j),yd(k),tt+1) + (1-n2)*Fd(xpp(i),z(j),ydd(k),tt+1))));
If more code is required, I can certainly provide I keep getting this error, but I have no idea what’s causing it.
Using the step button brings up nothing until the very end when it tries to finish.
all of the X’s,Z’s,Y’s within Fd are 15×1 with positive integers
Any ideas as to what’s causing this?
Fd=zeros(cap, cap, cap,term); %here is the original matrix I created cap=15 and term=20
…
for tt=19:-1:1
for i=1:cap
for j=1:cap
for k=1:cap
… %for brevity’s sake I’ve ommitted some stuff here that doesn’t seem to be causing issues
Fd(i,j,k,tt)= b*(…
m1*(…
p(y(j),z1(k))*(n1*Fd(xp(i),zp(j),y(k),tt+1) + (1-n1)*Fd(xpp(i),zpp(j),y(k),tt+1))+…
(1-p(y(j),z1(k)))*(n2*Fd(xp(i),z1(j),yg(k),tt+1) + (1-n2)*Fd(xpp(i),z1(j),ygg(k),tt+1)))+…
(1-m1)*(…
p2(y(j),z2(k))*(n1*Fd(xp(i),zd(j),y(k),tt+1) + (1-n1)*Fd(xpp(i),zdd(j),y(k),tt+1))+…
(1-p2(y(j),z2(k)))*(n2*Fd(xp(i),z2(j),yg(k),tt+1) + (1-n2)*Fd(xpp(i),z2(j),ygg(k),tt+1))…
))+…
(1-b)*( …
m2*(…
p(y1(j),z(k))*(n1*Fd(xp(i),zg(j),y1(k),tt+1) + (1-n1)*Fd(xpp(i) ,zgg(j),y1(k),tt+1))+ …
(1-p(y1(j),z(k)))*(n2*Fd(xp(i),z(j),yp(k),tt+1) + (1-n2)*Fd(xpp(i) ,z(j),ypp(k),tt+1)))+ …
(1-m2)*(p(y2(j),z(k))*(n1*Fd(xp(i),zg(j),y2(k),tt+1) + (1-n1)*Fd(xpp(i),zgg(j),y2(k),tt+1))+…
(1-p(y2(j),z(k)))*(n2*Fd(xp(i),z(j),yd(k),tt+1) + (1-n2)*Fd(xpp(i),z(j),ydd(k),tt+1))));
If more code is required, I can certainly provide matrix array MATLAB Answers — New Questions
copy subplots within same figure
I am copying subplots within a figure, to show the same data with an expaned time base.
As you can see from the example below, the copied subplots overlap somewhat, and the legends do not get copied. Is there a better way to do this?
t=(0:200)’;
x=[cos(t),sin(t),cos(t/2),sin(t/2),cos(t/4),sin(t/4)];
fig1=figure(1);
ax1(1,1)=subplot(321);
plot(t,x(:,1),’-r’,t,x(:,2),’-g’);
xlabel(‘Time’); ylabel(‘XA’); title(‘A’); legend({‘cos’,’sin’})
ax1(2,1)=subplot(323);
plot(t,x(:,3),’-b’,t,x(:,4),’-c’);
xlabel(‘Time’); ylabel(‘XB’); title(‘B’); legend({‘cos’,’sin’})
ax1(3,1)=subplot(325);
plot(t,x(:,5),’-m’,t,x(:,6),’-y’);
xlabel(‘Time’); ylabel(‘XC’); title(‘C’); legend({‘cos’,’sin’})
% Next: Copy column 1 plots to column 2, and adjust axes.
for i=1:3
axtemp=subplot(3,2,2*i);
ax1(i,2)=copyobj(ax1(i,1),fig1);
ax1(i,2).Position=axtemp.Position;
delete(axtemp)
xlim([0,20])
end
Thank you.I am copying subplots within a figure, to show the same data with an expaned time base.
As you can see from the example below, the copied subplots overlap somewhat, and the legends do not get copied. Is there a better way to do this?
t=(0:200)’;
x=[cos(t),sin(t),cos(t/2),sin(t/2),cos(t/4),sin(t/4)];
fig1=figure(1);
ax1(1,1)=subplot(321);
plot(t,x(:,1),’-r’,t,x(:,2),’-g’);
xlabel(‘Time’); ylabel(‘XA’); title(‘A’); legend({‘cos’,’sin’})
ax1(2,1)=subplot(323);
plot(t,x(:,3),’-b’,t,x(:,4),’-c’);
xlabel(‘Time’); ylabel(‘XB’); title(‘B’); legend({‘cos’,’sin’})
ax1(3,1)=subplot(325);
plot(t,x(:,5),’-m’,t,x(:,6),’-y’);
xlabel(‘Time’); ylabel(‘XC’); title(‘C’); legend({‘cos’,’sin’})
% Next: Copy column 1 plots to column 2, and adjust axes.
for i=1:3
axtemp=subplot(3,2,2*i);
ax1(i,2)=copyobj(ax1(i,1),fig1);
ax1(i,2).Position=axtemp.Position;
delete(axtemp)
xlim([0,20])
end
Thank you. I am copying subplots within a figure, to show the same data with an expaned time base.
As you can see from the example below, the copied subplots overlap somewhat, and the legends do not get copied. Is there a better way to do this?
t=(0:200)’;
x=[cos(t),sin(t),cos(t/2),sin(t/2),cos(t/4),sin(t/4)];
fig1=figure(1);
ax1(1,1)=subplot(321);
plot(t,x(:,1),’-r’,t,x(:,2),’-g’);
xlabel(‘Time’); ylabel(‘XA’); title(‘A’); legend({‘cos’,’sin’})
ax1(2,1)=subplot(323);
plot(t,x(:,3),’-b’,t,x(:,4),’-c’);
xlabel(‘Time’); ylabel(‘XB’); title(‘B’); legend({‘cos’,’sin’})
ax1(3,1)=subplot(325);
plot(t,x(:,5),’-m’,t,x(:,6),’-y’);
xlabel(‘Time’); ylabel(‘XC’); title(‘C’); legend({‘cos’,’sin’})
% Next: Copy column 1 plots to column 2, and adjust axes.
for i=1:3
axtemp=subplot(3,2,2*i);
ax1(i,2)=copyobj(ax1(i,1),fig1);
ax1(i,2).Position=axtemp.Position;
delete(axtemp)
xlim([0,20])
end
Thank you. subplot copyobj MATLAB Answers — New Questions
How to detect (programmatically induced) value changes of uidropdown?
Situation:
I am currently creating a UI with some dropdown menus that are dynamically populated (based on hardware devices that are connected to the PC). I might change the selectable items and the value programmatically without a user action required.
I want to trigger the execution of a function on the change of the value of the dropdown menu.
I am aware of the ValueChangedFcn callback. However this callback is only executed when the change is made by the user via the UI and not by programmatically induced changes to the value, as one can read in the documentation (This callback function executes when the user selects a different option from the drop-down list. It does not execute if the Value property changes programmatically).
What does not work:
Typically I would add an event listener but the property Value is not SetObservable so this does not work.
Subclassing the class to register a custom set method is also not possible cause uidropdown is sealed.
In my case I always know when I change the value programatically and I could trigger the desired function manually but this does not seem right to me because I then need use the ValueChngedFcn for user changes, add the function every time I change the value and/or write a custom function that changes the value and then automatically executes the function.
All of that seems not right because I would really like to bind the triggering of the function to the change of the value itself and not the cause of it.
Am I misusing uidropdown?
Do I misuse the dropdown menu to store a value and should rather have a separate variable for it that will be changed when the user makes a selection in the dropdown menu?
When using a separate variable I need to take special care to properly initalize that variable and the dropdown menu so that it reflects the value in the dropdown manu at all times.
>> What are your ideas to solve this problem in an elegant way?Situation:
I am currently creating a UI with some dropdown menus that are dynamically populated (based on hardware devices that are connected to the PC). I might change the selectable items and the value programmatically without a user action required.
I want to trigger the execution of a function on the change of the value of the dropdown menu.
I am aware of the ValueChangedFcn callback. However this callback is only executed when the change is made by the user via the UI and not by programmatically induced changes to the value, as one can read in the documentation (This callback function executes when the user selects a different option from the drop-down list. It does not execute if the Value property changes programmatically).
What does not work:
Typically I would add an event listener but the property Value is not SetObservable so this does not work.
Subclassing the class to register a custom set method is also not possible cause uidropdown is sealed.
In my case I always know when I change the value programatically and I could trigger the desired function manually but this does not seem right to me because I then need use the ValueChngedFcn for user changes, add the function every time I change the value and/or write a custom function that changes the value and then automatically executes the function.
All of that seems not right because I would really like to bind the triggering of the function to the change of the value itself and not the cause of it.
Am I misusing uidropdown?
Do I misuse the dropdown menu to store a value and should rather have a separate variable for it that will be changed when the user makes a selection in the dropdown menu?
When using a separate variable I need to take special care to properly initalize that variable and the dropdown menu so that it reflects the value in the dropdown manu at all times.
>> What are your ideas to solve this problem in an elegant way? Situation:
I am currently creating a UI with some dropdown menus that are dynamically populated (based on hardware devices that are connected to the PC). I might change the selectable items and the value programmatically without a user action required.
I want to trigger the execution of a function on the change of the value of the dropdown menu.
I am aware of the ValueChangedFcn callback. However this callback is only executed when the change is made by the user via the UI and not by programmatically induced changes to the value, as one can read in the documentation (This callback function executes when the user selects a different option from the drop-down list. It does not execute if the Value property changes programmatically).
What does not work:
Typically I would add an event listener but the property Value is not SetObservable so this does not work.
Subclassing the class to register a custom set method is also not possible cause uidropdown is sealed.
In my case I always know when I change the value programatically and I could trigger the desired function manually but this does not seem right to me because I then need use the ValueChngedFcn for user changes, add the function every time I change the value and/or write a custom function that changes the value and then automatically executes the function.
All of that seems not right because I would really like to bind the triggering of the function to the change of the value itself and not the cause of it.
Am I misusing uidropdown?
Do I misuse the dropdown menu to store a value and should rather have a separate variable for it that will be changed when the user makes a selection in the dropdown menu?
When using a separate variable I need to take special care to properly initalize that variable and the dropdown menu so that it reflects the value in the dropdown manu at all times.
>> What are your ideas to solve this problem in an elegant way? app designer, callback, uidropdown MATLAB Answers — New Questions
New Desktop for MATLAB not working on Ubuntu (Wayland)
On Linux Ubuntu, when I switch to using the New Desktop for MATLAB, I can’t type in the command window or inside a script, and I cannot change any settings in the prefferences window. I wanted to use the dark theme, but the dropdown menus are not functional – if I select something in a dropdown menu, it just closes without updating.
On Ubuntu login, there’s a cogwheel in the bottom right to choose if I wanna start my session using Ubuntu (on Wayland, default) or Ubuntu on Xorg. Wayland is the default windowing system that I’ve been using ever since, but once I tried with Xorg, New Desktop for MATLAB worked as expected. However, I don’t wanna keep using Xorg since a lot of Ubuntu options that I had set in Wayland don’t stick (examples are natural scrolling, disable touchpad while typing, three-finger middle-click). I managed to change the theme in Xorg and switch back to Wayland and the dark theme stayed, but other issues still persist.
Is this a known issue?
More importantly, is there a way to make New Desktop for MATLAB work on default Ubuntu (Wayland), or do I have to use Ubuntu on Xorg?
Version: Ubuntu 22.04.4 LTSOn Linux Ubuntu, when I switch to using the New Desktop for MATLAB, I can’t type in the command window or inside a script, and I cannot change any settings in the prefferences window. I wanted to use the dark theme, but the dropdown menus are not functional – if I select something in a dropdown menu, it just closes without updating.
On Ubuntu login, there’s a cogwheel in the bottom right to choose if I wanna start my session using Ubuntu (on Wayland, default) or Ubuntu on Xorg. Wayland is the default windowing system that I’ve been using ever since, but once I tried with Xorg, New Desktop for MATLAB worked as expected. However, I don’t wanna keep using Xorg since a lot of Ubuntu options that I had set in Wayland don’t stick (examples are natural scrolling, disable touchpad while typing, three-finger middle-click). I managed to change the theme in Xorg and switch back to Wayland and the dark theme stayed, but other issues still persist.
Is this a known issue?
More importantly, is there a way to make New Desktop for MATLAB work on default Ubuntu (Wayland), or do I have to use Ubuntu on Xorg?
Version: Ubuntu 22.04.4 LTS On Linux Ubuntu, when I switch to using the New Desktop for MATLAB, I can’t type in the command window or inside a script, and I cannot change any settings in the prefferences window. I wanted to use the dark theme, but the dropdown menus are not functional – if I select something in a dropdown menu, it just closes without updating.
On Ubuntu login, there’s a cogwheel in the bottom right to choose if I wanna start my session using Ubuntu (on Wayland, default) or Ubuntu on Xorg. Wayland is the default windowing system that I’ve been using ever since, but once I tried with Xorg, New Desktop for MATLAB worked as expected. However, I don’t wanna keep using Xorg since a lot of Ubuntu options that I had set in Wayland don’t stick (examples are natural scrolling, disable touchpad while typing, three-finger middle-click). I managed to change the theme in Xorg and switch back to Wayland and the dark theme stayed, but other issues still persist.
Is this a known issue?
More importantly, is there a way to make New Desktop for MATLAB work on default Ubuntu (Wayland), or do I have to use Ubuntu on Xorg?
Version: Ubuntu 22.04.4 LTS linux, ubuntu MATLAB Answers — New Questions