Category: News
print only odd pages?
In Excel, how do I print only odd pages? I’m on a pc.
In Excel, how do I print only odd pages? I’m on a pc. Read More
Azure Migrate availability for Southeast Asia
Just to check whether any of you facing any issue on testing Azure Migrate in Southeast Asia region ?
I’m facing a issue where the Azure Migrate dashboard can’t identify the “source appliance” that configured and discovering the VMs on source location, which causing problem on setting up “Target appliance”.
Just to check whether any of you facing any issue on testing Azure Migrate in Southeast Asia region ? I’m facing a issue where the Azure Migrate dashboard can’t identify the “source appliance” that configured and discovering the VMs on source location, which causing problem on setting up “Target appliance”. Read More
Align various discontinous data sets into a chronological ordered matrix
I have four data sets (K,L,M,N) that look at Y-Axis over 24 hours in seconds given in 60 second time intervals ( time, elevation matrix), all with different matrix lengths from two different sections (two sets from each section (A or B))
The time in these data sets is not continuous.
I want to combine the data and align them in a chronological time vector that spans 1: 86400 (represents seconds in 24 hrs, given in 60 second increments, total length 1440)
Basically I want these data sets to align in time and to know from which data set the data came from (which V and section)
If two data sets align at the same time, I want to be able to choose which data set I’d prefer (to give preference to section A)
Any gaps in time when none of the data lines up with the time vector, I want those values to be 0
If there are two data sets that align in time, I would like to create a secondary matrix with the information
Any advice? Thanks!I have four data sets (K,L,M,N) that look at Y-Axis over 24 hours in seconds given in 60 second time intervals ( time, elevation matrix), all with different matrix lengths from two different sections (two sets from each section (A or B))
The time in these data sets is not continuous.
I want to combine the data and align them in a chronological time vector that spans 1: 86400 (represents seconds in 24 hrs, given in 60 second increments, total length 1440)
Basically I want these data sets to align in time and to know from which data set the data came from (which V and section)
If two data sets align at the same time, I want to be able to choose which data set I’d prefer (to give preference to section A)
Any gaps in time when none of the data lines up with the time vector, I want those values to be 0
If there are two data sets that align in time, I would like to create a secondary matrix with the information
Any advice? Thanks! I have four data sets (K,L,M,N) that look at Y-Axis over 24 hours in seconds given in 60 second time intervals ( time, elevation matrix), all with different matrix lengths from two different sections (two sets from each section (A or B))
The time in these data sets is not continuous.
I want to combine the data and align them in a chronological time vector that spans 1: 86400 (represents seconds in 24 hrs, given in 60 second increments, total length 1440)
Basically I want these data sets to align in time and to know from which data set the data came from (which V and section)
If two data sets align at the same time, I want to be able to choose which data set I’d prefer (to give preference to section A)
Any gaps in time when none of the data lines up with the time vector, I want those values to be 0
If there are two data sets that align in time, I would like to create a secondary matrix with the information
Any advice? Thanks! discontinous matrix, chronological MATLAB Answers — New Questions
How to calculate accuracy from confusion matrix?
How to calculate accuracy from confusion matrix?How to calculate accuracy from confusion matrix? How to calculate accuracy from confusion matrix? accuracy MATLAB Answers — New Questions
How can I find the FFT of a time series when the samples are not equally spaced?
How do I find the FFT of a time series with nonuniformly spaced samples?How do I find the FFT of a time series with nonuniformly spaced samples? How do I find the FFT of a time series with nonuniformly spaced samples? non-constant, fixed, variable, step, fft, random, randomly, spaced, data MATLAB Answers — New Questions
Returning an array of colors from a double image
I am trying to write a function that takes a type double image as input and returns an array of the colors in that image. The returned colors are supposed to be in a matrix form. The colors in my existing image are red, green, blue, white, and yellow. I can’t get my head around this. Any suggestions?I am trying to write a function that takes a type double image as input and returns an array of the colors in that image. The returned colors are supposed to be in a matrix form. The colors in my existing image are red, green, blue, white, and yellow. I can’t get my head around this. Any suggestions? I am trying to write a function that takes a type double image as input and returns an array of the colors in that image. The returned colors are supposed to be in a matrix form. The colors in my existing image are red, green, blue, white, and yellow. I can’t get my head around this. Any suggestions? matrix array, gamut of colors in image MATLAB Answers — New Questions
April V1 Title Plan out now!
The Monthly Title Plan for April V1 is attached to this post. The Title Plan can also be found in the following locations:
MPN Partner Portal Learning Resources page Resource page for Training Services Partners (Title Plan publishing takes 2-3 business days)
MCT Lounge Brand-new lounge for MCTs
We have removed retired courses from the Title Plan after they have been retired for 30 days. For future reference, a list of all retired courses can be found here: https://learn.microsoft.com/en-us/certifications/retired-courses
The Monthly Title Plan for April V1 is attached to this post. The Title Plan can also be found in the following locations:
MPN Partner Portal Learning Resources page Resource page for Training Services Partners (Title Plan publishing takes 2-3 business days)
MCT Lounge Brand-new lounge for MCTs
We have removed retired courses from the Title Plan after they have been retired for 30 days. For future reference, a list of all retired courses can be found here: https://learn.microsoft.com/en-us/certifications/retired-courses Read More
Renew Edge Subscription in Exchange Server 2019 after upgrade Cumulative Update 14
My environment is Exchange 2019. I have upgraded all mailbox server from CU12 to CU14.
Question: Do I need to renew Edge Subscription and run Hybrid Wizard again when I upgrade on Edge Server?
Hope to receive reply soon. Thanks a lot
My environment is Exchange 2019. I have upgraded all mailbox server from CU12 to CU14.Question: Do I need to renew Edge Subscription and run Hybrid Wizard again when I upgrade on Edge Server?Hope to receive reply soon. Thanks a lot Read More
Images in Power Apps Rich Text Editor
There is an issue where the app’s rich text fields no longer save images. If an image is pasted into one of the rich text fields in edit mode the image will appear in the text box. However, after saving the image disappears.
The Power App is integrated with a SharePoint list. The app also has a Power Automate flow that runs when the user clicks a button which creates an HTML file for the item in the list:
Does anyone know if Microsoft changed how the rich text field for Power Apps handles images? Or is it possible that a setting in the app or list was changed by mistake so that images are no longer allowed in the rich text field? The columns with rich text all have enhanced rich text enabled so I’m not sure what’s causing the issue. The flow has also not been modified since February and the issue started about 2 weeks ago.
There is an issue where the app’s rich text fields no longer save images. If an image is pasted into one of the rich text fields in edit mode the image will appear in the text box. However, after saving the image disappears. The Power App is integrated with a SharePoint list. The app also has a Power Automate flow that runs when the user clicks a button which creates an HTML file for the item in the list: Does anyone know if Microsoft changed how the rich text field for Power Apps handles images? Or is it possible that a setting in the app or list was changed by mistake so that images are no longer allowed in the rich text field? The columns with rich text all have enhanced rich text enabled so I’m not sure what’s causing the issue. The flow has also not been modified since February and the issue started about 2 weeks ago. Read More
How to plot the selected column on app.UItable .
Hi all,
I am working on developing an application in matalb. The Run botton will import the excel file and display the columns in the table. I want to program the plot botton in such a way that once the columns are selected in the app.UItable and plot botton clicked by the user. A plot is generated in the app.UIaxes.
I am getting difficulty in coding the second portion where I want to select the column and plot them.
Any help will be greatly appreciated.
Thank youHi all,
I am working on developing an application in matalb. The Run botton will import the excel file and display the columns in the table. I want to program the plot botton in such a way that once the columns are selected in the app.UItable and plot botton clicked by the user. A plot is generated in the app.UIaxes.
I am getting difficulty in coding the second portion where I want to select the column and plot them.
Any help will be greatly appreciated.
Thank you Hi all,
I am working on developing an application in matalb. The Run botton will import the excel file and display the columns in the table. I want to program the plot botton in such a way that once the columns are selected in the app.UItable and plot botton clicked by the user. A plot is generated in the app.UIaxes.
I am getting difficulty in coding the second portion where I want to select the column and plot them.
Any help will be greatly appreciated.
Thank you appdesigner MATLAB Answers — New Questions
Change working directory on a Linux based server
I wrote a script that opens Medical Image Labeler and loads some images in it to be annotated by the user. When the command medicalImageLabeler(gTruth) is executed, the app opens and a popup window (see figure) asks the user to select the path of the new session folder and to enter the name of the session folder. I want the predefined path of the session folder to be the same of the current working directory.
For example: if the current working directory is C:UsersMynameDocuments, the predefined folder for the new Medical Image Labeler’s session has to be C:UsersMynameDocuments.
On my Windows PC I was able to obtain this behavior by setting the working directory with cd, pointing to the desired path (e.g. cd(userFolder) where userFolder = "C:UsersMynameDocuments").
The solution above doesn’t seem to work in the PCs connected to my department server, which run Linux. In this case the predefined folder for savings in the Medical Image Labeler app is always the MATLAB folder (e.g. C:UsersMynameDocumentsMATLAB or similar in the linux environment, I don’t rememeber exactly the folder path) even if run the code in a different folder and even if I change the working directory with cd before opening Medical Image Labeler.
Could it be a problem due to the different operating system? Is there a way to fix it?I wrote a script that opens Medical Image Labeler and loads some images in it to be annotated by the user. When the command medicalImageLabeler(gTruth) is executed, the app opens and a popup window (see figure) asks the user to select the path of the new session folder and to enter the name of the session folder. I want the predefined path of the session folder to be the same of the current working directory.
For example: if the current working directory is C:UsersMynameDocuments, the predefined folder for the new Medical Image Labeler’s session has to be C:UsersMynameDocuments.
On my Windows PC I was able to obtain this behavior by setting the working directory with cd, pointing to the desired path (e.g. cd(userFolder) where userFolder = "C:UsersMynameDocuments").
The solution above doesn’t seem to work in the PCs connected to my department server, which run Linux. In this case the predefined folder for savings in the Medical Image Labeler app is always the MATLAB folder (e.g. C:UsersMynameDocumentsMATLAB or similar in the linux environment, I don’t rememeber exactly the folder path) even if run the code in a different folder and even if I change the working directory with cd before opening Medical Image Labeler.
Could it be a problem due to the different operating system? Is there a way to fix it? I wrote a script that opens Medical Image Labeler and loads some images in it to be annotated by the user. When the command medicalImageLabeler(gTruth) is executed, the app opens and a popup window (see figure) asks the user to select the path of the new session folder and to enter the name of the session folder. I want the predefined path of the session folder to be the same of the current working directory.
For example: if the current working directory is C:UsersMynameDocuments, the predefined folder for the new Medical Image Labeler’s session has to be C:UsersMynameDocuments.
On my Windows PC I was able to obtain this behavior by setting the working directory with cd, pointing to the desired path (e.g. cd(userFolder) where userFolder = "C:UsersMynameDocuments").
The solution above doesn’t seem to work in the PCs connected to my department server, which run Linux. In this case the predefined folder for savings in the Medical Image Labeler app is always the MATLAB folder (e.g. C:UsersMynameDocumentsMATLAB or similar in the linux environment, I don’t rememeber exactly the folder path) even if run the code in a different folder and even if I change the working directory with cd before opening Medical Image Labeler.
Could it be a problem due to the different operating system? Is there a way to fix it? medical image labeler, linux, windows, cd, path, working directory MATLAB Answers — New Questions
Reading CR2 (Canon RAW) images into MATLAB
Hi,
I was wondering if anyone could help me to read in some CR2 images into MATLAB?
I have tried just using imread but it just reads the image as an 8 bit. I can used Adobe’s DNG converter as people have suggested but would rather have the whole code automated. Other questions like this are a few years old so was hoping some people had new suggestions.
Thanks!Hi,
I was wondering if anyone could help me to read in some CR2 images into MATLAB?
I have tried just using imread but it just reads the image as an 8 bit. I can used Adobe’s DNG converter as people have suggested but would rather have the whole code automated. Other questions like this are a few years old so was hoping some people had new suggestions.
Thanks! Hi,
I was wondering if anyone could help me to read in some CR2 images into MATLAB?
I have tried just using imread but it just reads the image as an 8 bit. I can used Adobe’s DNG converter as people have suggested but would rather have the whole code automated. Other questions like this are a few years old so was hoping some people had new suggestions.
Thanks! raw file, image processing, imread, canon, cr2, read in raw MATLAB Answers — New Questions
How can I programmatically create a new MATLAB script and paste string from system clipboard to it in MATLAB R2021b?
I am using MATLAB R2021b, and I have copied some text to my system clipboard. Is there a way that I can programmatically create a new MATLAB script and then paste the text from system clipboard to it?I am using MATLAB R2021b, and I have copied some text to my system clipboard. Is there a way that I can programmatically create a new MATLAB script and then paste the text from system clipboard to it? I am using MATLAB R2021b, and I have copied some text to my system clipboard. Is there a way that I can programmatically create a new MATLAB script and then paste the text from system clipboard to it? clipboard, fopen, fprintf MATLAB Answers — New Questions
URL to on prem server
Hello,
How do I setup Intune to access on prem https services from my phone? We have Intune managing our phones and would like to be able to access on prem URL https://myservice.mycompany.pri?
Thanks
Grant
Hello, How do I setup Intune to access on prem https services from my phone? We have Intune managing our phones and would like to be able to access on prem URL https://myservice.mycompany.pri? ThanksGrant Read More
Can MFA duration be set per-user with/without a P1/P2 Entra license?
My leadership is looking to roll out a new company policy that will forces shorter MFA duration times on specific users based on various criteria. Not looking for changes to persistent browser sessions or sign-in frequency. Just a way to set how long a specific user/group has before that are required to respond to another MFA challenge.
I thought that any manual changes to MFA duration were tenant-wide. I know there are risk-based CA policies but we want to be able to manually set the duration instead of waiting for the system to flag them as “risky” — risk-based CA policies have limited reporting capabilities without a Premium license anyway, so that’s kind of a non-starter.
I found this article that talks about changing session duration (not MFA duration) for select users but, again, this requires a P1/P2 license.
Am I totally incorrect with the “MFA duration is tenant-level only” idea? Just don’t want to break the news to my leadership only to find out it was possible all along.
My leadership is looking to roll out a new company policy that will forces shorter MFA duration times on specific users based on various criteria. Not looking for changes to persistent browser sessions or sign-in frequency. Just a way to set how long a specific user/group has before that are required to respond to another MFA challenge. I thought that any manual changes to MFA duration were tenant-wide. I know there are risk-based CA policies but we want to be able to manually set the duration instead of waiting for the system to flag them as “risky” — risk-based CA policies have limited reporting capabilities without a Premium license anyway, so that’s kind of a non-starter. I found this article that talks about changing session duration (not MFA duration) for select users but, again, this requires a P1/P2 license. Am I totally incorrect with the “MFA duration is tenant-level only” idea? Just don’t want to break the news to my leadership only to find out it was possible all along. Read More
Organizing Photos
I digitizing all of my parents’ photos and a lot of them have written descriptions on the back. How do I keep both sides of a photo together when uploading? Is this possible? It seems that when I upload them, they become scrambled. Is this possible to keep them organized the way I have them on my hard drive?
I digitizing all of my parents’ photos and a lot of them have written descriptions on the back. How do I keep both sides of a photo together when uploading? Is this possible? It seems that when I upload them, they become scrambled. Is this possible to keep them organized the way I have them on my hard drive? Read More
Full trash bin
I’ve emptied a user’s trash bin twice now, after finding that it was 99% full. After emptying the first time, it seemed to be fixed, but then it happened again. I repeated the process, but now the mailbox is 99% full again.
I need help with two things 1) Why is the user’s mailbox/trash bin still filled mail I thought I deleted? 2) where do you access the feature within Office 365 Admin to delete the user’s trash bin?
I’ve emptied a user’s trash bin twice now, after finding that it was 99% full. After emptying the first time, it seemed to be fixed, but then it happened again. I repeated the process, but now the mailbox is 99% full again. I need help with two things 1) Why is the user’s mailbox/trash bin still filled mail I thought I deleted? 2) where do you access the feature within Office 365 Admin to delete the user’s trash bin? Read More
Create Class that is both Heterogeneous and a Handle class
2 things.
1) I am looking to create a class that is both a handle class object which allows reference copies of that first object to be distributed / moved which may edit the contents of the first class object AND also be "matlab.mixin.Heterogeneous" which allows there to be an array of objects that differ in their specific class, but are all derived from one root class. In this case that I am looking for all these objects root and derived to also be handel classes.
2) I’m looking for some way to add/remove oject handles from an object’s properties dynamically. I’m not sure how this is normally handeled is Object Oriented Programming, where objects are moved between other objects like people moving form one location to another location.
For example, if I were to simulate people at a obstical course, I would have a class called People, and a root class called Locations for which there are derived classes from, like Swing, Slide, RockWall exe. In this example I want the people object to have a handle to their current location (object), and the different location classes to have a handle to what person is persent, and what location is next in the obstical course after the current one.
Alternativly, if there is maybe a better way of structuring this then I’ve mentioned I would like to know.
classdef Location < matlab.mixin.Heterogeneous %< handle ??????????? NOT SURE HOW MAKE THIS A HANDLE
% "Location" objects are able to change properties of "Person" obj and
% "Location" obj through the handles stored in this classes local properties
properties
locationID (1,1) uint16 {mustBeInteger,mustBePositive} = 1
person (1,1) Person %handle ref, so this class may make changes to it
%next location in the obstical course:
nextLocation (1,1) Location %handle ref, so this class may make changes to it
end
methods
function movePerson(NewLocation,Person)
%find person’s prev location
prevLocation = Person.currentLocation;
%check if new Location’s person is empty
if isempty(NewLocation.person)
%set person’s prev location to empty
clear(prevLocation.person);%????????? NOT SURE HOW TO DO THIS
%Update Location’s person property
NewLocation.person = Person; %copy person handle to location obj
%Update Person’s Location property
Person.currentLocation = NewLocation; %copy location handel to person obj
end
end
end
end
classdef Swing < Location %< handle
methods
function done = sendNextLocation(Location)
if isempty(Location.nextLocation.person) %Swing objects may only accept one person at at a time
Location.AddPerson(Location.nextLocation,Location.person);
Location.RemovePerson(Location);
done = 1;
else
done = 0;
end
end
end
end
classdef Person < handle
properties
ID (1,1) uint16 {mustBeInteger,mustBePositive} = 1
currentLocation (1,1) Location
end
end2 things.
1) I am looking to create a class that is both a handle class object which allows reference copies of that first object to be distributed / moved which may edit the contents of the first class object AND also be "matlab.mixin.Heterogeneous" which allows there to be an array of objects that differ in their specific class, but are all derived from one root class. In this case that I am looking for all these objects root and derived to also be handel classes.
2) I’m looking for some way to add/remove oject handles from an object’s properties dynamically. I’m not sure how this is normally handeled is Object Oriented Programming, where objects are moved between other objects like people moving form one location to another location.
For example, if I were to simulate people at a obstical course, I would have a class called People, and a root class called Locations for which there are derived classes from, like Swing, Slide, RockWall exe. In this example I want the people object to have a handle to their current location (object), and the different location classes to have a handle to what person is persent, and what location is next in the obstical course after the current one.
Alternativly, if there is maybe a better way of structuring this then I’ve mentioned I would like to know.
classdef Location < matlab.mixin.Heterogeneous %< handle ??????????? NOT SURE HOW MAKE THIS A HANDLE
% "Location" objects are able to change properties of "Person" obj and
% "Location" obj through the handles stored in this classes local properties
properties
locationID (1,1) uint16 {mustBeInteger,mustBePositive} = 1
person (1,1) Person %handle ref, so this class may make changes to it
%next location in the obstical course:
nextLocation (1,1) Location %handle ref, so this class may make changes to it
end
methods
function movePerson(NewLocation,Person)
%find person’s prev location
prevLocation = Person.currentLocation;
%check if new Location’s person is empty
if isempty(NewLocation.person)
%set person’s prev location to empty
clear(prevLocation.person);%????????? NOT SURE HOW TO DO THIS
%Update Location’s person property
NewLocation.person = Person; %copy person handle to location obj
%Update Person’s Location property
Person.currentLocation = NewLocation; %copy location handel to person obj
end
end
end
end
classdef Swing < Location %< handle
methods
function done = sendNextLocation(Location)
if isempty(Location.nextLocation.person) %Swing objects may only accept one person at at a time
Location.AddPerson(Location.nextLocation,Location.person);
Location.RemovePerson(Location);
done = 1;
else
done = 0;
end
end
end
end
classdef Person < handle
properties
ID (1,1) uint16 {mustBeInteger,mustBePositive} = 1
currentLocation (1,1) Location
end
end 2 things.
1) I am looking to create a class that is both a handle class object which allows reference copies of that first object to be distributed / moved which may edit the contents of the first class object AND also be "matlab.mixin.Heterogeneous" which allows there to be an array of objects that differ in their specific class, but are all derived from one root class. In this case that I am looking for all these objects root and derived to also be handel classes.
2) I’m looking for some way to add/remove oject handles from an object’s properties dynamically. I’m not sure how this is normally handeled is Object Oriented Programming, where objects are moved between other objects like people moving form one location to another location.
For example, if I were to simulate people at a obstical course, I would have a class called People, and a root class called Locations for which there are derived classes from, like Swing, Slide, RockWall exe. In this example I want the people object to have a handle to their current location (object), and the different location classes to have a handle to what person is persent, and what location is next in the obstical course after the current one.
Alternativly, if there is maybe a better way of structuring this then I’ve mentioned I would like to know.
classdef Location < matlab.mixin.Heterogeneous %< handle ??????????? NOT SURE HOW MAKE THIS A HANDLE
% "Location" objects are able to change properties of "Person" obj and
% "Location" obj through the handles stored in this classes local properties
properties
locationID (1,1) uint16 {mustBeInteger,mustBePositive} = 1
person (1,1) Person %handle ref, so this class may make changes to it
%next location in the obstical course:
nextLocation (1,1) Location %handle ref, so this class may make changes to it
end
methods
function movePerson(NewLocation,Person)
%find person’s prev location
prevLocation = Person.currentLocation;
%check if new Location’s person is empty
if isempty(NewLocation.person)
%set person’s prev location to empty
clear(prevLocation.person);%????????? NOT SURE HOW TO DO THIS
%Update Location’s person property
NewLocation.person = Person; %copy person handle to location obj
%Update Person’s Location property
Person.currentLocation = NewLocation; %copy location handel to person obj
end
end
end
end
classdef Swing < Location %< handle
methods
function done = sendNextLocation(Location)
if isempty(Location.nextLocation.person) %Swing objects may only accept one person at at a time
Location.AddPerson(Location.nextLocation,Location.person);
Location.RemovePerson(Location);
done = 1;
else
done = 0;
end
end
end
end
classdef Person < handle
properties
ID (1,1) uint16 {mustBeInteger,mustBePositive} = 1
currentLocation (1,1) Location
end
end class, handles MATLAB Answers — New Questions
Saving and Restoring Simulation States in an External Application from a Code-Generated Simulink Model with Custom S-Functions
I have a fixed-step Simulink model that includes a referenced model with a custom S-function. This S-function is built with the legacy code tool using a DLL that was compiled from Ada and C code. I plan to autocode this entire Simulink model into a library, which I intend to use in an external non-Matlab real time environment with optional man-in-the-loop inputs. In this external environment, we want to be able to save the simulation’s state at a certain point and then load it back later to continue the simulation repeatably.
We’re in a planning phase and I need to determine whether this is feasible. I’ve looked through some of the documentation and other questions but this use case seems a little out of the ordinary, and it’s not clear to me that the RestoreOperatingPoint etc will work in this case. Will RestoreOperatingPoint work in this scenario, or is there another approach?I have a fixed-step Simulink model that includes a referenced model with a custom S-function. This S-function is built with the legacy code tool using a DLL that was compiled from Ada and C code. I plan to autocode this entire Simulink model into a library, which I intend to use in an external non-Matlab real time environment with optional man-in-the-loop inputs. In this external environment, we want to be able to save the simulation’s state at a certain point and then load it back later to continue the simulation repeatably.
We’re in a planning phase and I need to determine whether this is feasible. I’ve looked through some of the documentation and other questions but this use case seems a little out of the ordinary, and it’s not clear to me that the RestoreOperatingPoint etc will work in this case. Will RestoreOperatingPoint work in this scenario, or is there another approach? I have a fixed-step Simulink model that includes a referenced model with a custom S-function. This S-function is built with the legacy code tool using a DLL that was compiled from Ada and C code. I plan to autocode this entire Simulink model into a library, which I intend to use in an external non-Matlab real time environment with optional man-in-the-loop inputs. In this external environment, we want to be able to save the simulation’s state at a certain point and then load it back later to continue the simulation repeatably.
We’re in a planning phase and I need to determine whether this is feasible. I’ve looked through some of the documentation and other questions but this use case seems a little out of the ordinary, and it’s not clear to me that the RestoreOperatingPoint etc will work in this case. Will RestoreOperatingPoint work in this scenario, or is there another approach? simulink, code generation, s-function, operating point, ada, c++ MATLAB Answers — New Questions
3D Visualization of Items Arrangement
How do I get the 3D visualization of items in the bin from this algorithm?
%
% Copyright (c) 2015, Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the "license.txt" for license terms.
%
% Project Code: YPAP105
% Project Title: Solving Bin Packing Problem using PSO, FA and IWO
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yarpiz Team)
%
% Contact Info: sm.kalami@gmail.com, info@yarpiz.com
%
clc;
clear;
close all;
%% Problem Definition
model = CreateModel(); % Create Bin Packing Model
CostFunction = @(x) BinPackingCost(x, model); % Objective Function
nVar = 2*model.n-1; % Number of Decision Variables
VarSize = [1 nVar]; % Decision Variables Matrix Size
VarMin = 0; % Lower Bound of Decision Variables
VarMax = 1; % Upper Bound of Decision Variables
%% PSO Parameters
MaxIt=50; % Maximum Number of Iterations
nPop=20; % Population Size (Swarm Size)
% PSO Parameters
w=1; % Inertia Weight
wdamp=0.99; % Inertia Weight Damping Ratio
c1=1.5; % Personal Learning Coefficient
c2=2.0; % Global Learning Coefficient
% If you would like to use Constriction Coefficients for PSO,
% uncomment the following block and comment the above set of parameters.
% % Constriction Coefficients
% phi1=2.05;
% phi2=2.05;
% phi=phi1+phi2;
% chi=2/(phi-2+sqrt(phi^2-4*phi));
% w=chi; % Inertia Weight
% wdamp=1; % Inertia Weight Damping Ratio
% c1=chi*phi1; % Personal Learning Coefficient
% c2=chi*phi2; % Global Learning Coefficient
% Velocity Limits
VelMax=0.1*(VarMax-VarMin);
VelMin=-VelMax;
nParticleMutation = 2; % Number of Mutations Performed on Each Particle
nGlobalBestMutation = 5; % Number of Mutations Performed on Global Best
%% Initialization
empty_particle.Position=[];
empty_particle.Cost=[];
empty_particle.Sol=[];
empty_particle.Velocity=[];
empty_particle.Best.Position=[];
empty_particle.Best.Cost=[];
empty_particle.Best.Sol=[];
particle=repmat(empty_particle,nPop,1);
GlobalBest.Cost=inf;
for i=1:nPop
% Initialize Position
particle(i).Position=unifrnd(VarMin,VarMax,VarSize);
% Initialize Velocity
particle(i).Velocity=zeros(VarSize);
% Evaluation
[particle(i).Cost, particle(i).Sol]=CostFunction(particle(i).Position);
% Update Personal Best
particle(i).Best.Position=particle(i).Position;
particle(i).Best.Cost=particle(i).Cost;
particle(i).Best.Sol=particle(i).Sol;
% Update Global Best
if particle(i).Best.Cost<GlobalBest.Cost
GlobalBest=particle(i).Best;
end
end
BestCost=zeros(MaxIt,1);
%% PSO Main Loop
for it=1:MaxIt
for i=1:nPop
% Update Velocity
particle(i).Velocity = w*particle(i).Velocity …
+c1*rand(VarSize).*(particle(i).Best.Position-particle(i).Position) …
+c2*rand(VarSize).*(GlobalBest.Position-particle(i).Position);
% Apply Velocity Limits
particle(i).Velocity = max(particle(i).Velocity,VelMin);
particle(i).Velocity = min(particle(i).Velocity,VelMax);
% Update Position
particle(i).Position = particle(i).Position + particle(i).Velocity;
% Velocity Mirror Effect
IsOutside=(particle(i).Position<VarMin | particle(i).Position>VarMax);
particle(i).Velocity(IsOutside)=-particle(i).Velocity(IsOutside);
% Apply Position Limits
particle(i).Position = max(particle(i).Position,VarMin);
particle(i).Position = min(particle(i).Position,VarMax);
% Evaluation
[particle(i).Cost, particle(i).Sol] = CostFunction(particle(i).Position);
% Perform Mutation
for j=1:nParticleMutation
NewParticle = particle(i);
NewParticle.Position = Mutate(particle(i).Position);
[NewParticle.Cost, NewParticle.Sol] = CostFunction(NewParticle.Position);
if NewParticle.Cost <= particle(i).Cost
particle(i) = NewParticle;
end
end
% Update Personal Best
if particle(i).Cost<particle(i).Best.Cost
particle(i).Best.Position=particle(i).Position;
particle(i).Best.Cost=particle(i).Cost;
particle(i).Best.Sol=particle(i).Sol;
% Update Global Best
if particle(i).Best.Cost<GlobalBest.Cost
GlobalBest=particle(i).Best;
end
end
end
% Perform Mutation on Global Best
for i=1:nGlobalBestMutation
NewParticle = GlobalBest;
NewParticle.Position = Mutate(GlobalBest.Position);
[NewParticle.Cost, NewParticle.Sol] = CostFunction(NewParticle.Position);
if NewParticle.Cost <= GlobalBest.Cost
GlobalBest = NewParticle;
end
end
BestCost(it)=GlobalBest.Cost;
disp([‘Iteration ‘ num2str(it) ‘: Best Cost = ‘ num2str(BestCost(it))]);
w=w*wdamp;
end
BestSol = GlobalBest;
%% Results
figure;
plot(BestCost,’LineWidth’,2);
xlabel(‘Iteration’);
ylabel(‘Best Cost’);
grid on;
i got this algorithm from https://www.mathworks.com/matlabcentral/fileexchange/53111-bin-packing-problem-using-ga-pso-fa-and-iwoHow do I get the 3D visualization of items in the bin from this algorithm?
%
% Copyright (c) 2015, Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the "license.txt" for license terms.
%
% Project Code: YPAP105
% Project Title: Solving Bin Packing Problem using PSO, FA and IWO
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yarpiz Team)
%
% Contact Info: sm.kalami@gmail.com, info@yarpiz.com
%
clc;
clear;
close all;
%% Problem Definition
model = CreateModel(); % Create Bin Packing Model
CostFunction = @(x) BinPackingCost(x, model); % Objective Function
nVar = 2*model.n-1; % Number of Decision Variables
VarSize = [1 nVar]; % Decision Variables Matrix Size
VarMin = 0; % Lower Bound of Decision Variables
VarMax = 1; % Upper Bound of Decision Variables
%% PSO Parameters
MaxIt=50; % Maximum Number of Iterations
nPop=20; % Population Size (Swarm Size)
% PSO Parameters
w=1; % Inertia Weight
wdamp=0.99; % Inertia Weight Damping Ratio
c1=1.5; % Personal Learning Coefficient
c2=2.0; % Global Learning Coefficient
% If you would like to use Constriction Coefficients for PSO,
% uncomment the following block and comment the above set of parameters.
% % Constriction Coefficients
% phi1=2.05;
% phi2=2.05;
% phi=phi1+phi2;
% chi=2/(phi-2+sqrt(phi^2-4*phi));
% w=chi; % Inertia Weight
% wdamp=1; % Inertia Weight Damping Ratio
% c1=chi*phi1; % Personal Learning Coefficient
% c2=chi*phi2; % Global Learning Coefficient
% Velocity Limits
VelMax=0.1*(VarMax-VarMin);
VelMin=-VelMax;
nParticleMutation = 2; % Number of Mutations Performed on Each Particle
nGlobalBestMutation = 5; % Number of Mutations Performed on Global Best
%% Initialization
empty_particle.Position=[];
empty_particle.Cost=[];
empty_particle.Sol=[];
empty_particle.Velocity=[];
empty_particle.Best.Position=[];
empty_particle.Best.Cost=[];
empty_particle.Best.Sol=[];
particle=repmat(empty_particle,nPop,1);
GlobalBest.Cost=inf;
for i=1:nPop
% Initialize Position
particle(i).Position=unifrnd(VarMin,VarMax,VarSize);
% Initialize Velocity
particle(i).Velocity=zeros(VarSize);
% Evaluation
[particle(i).Cost, particle(i).Sol]=CostFunction(particle(i).Position);
% Update Personal Best
particle(i).Best.Position=particle(i).Position;
particle(i).Best.Cost=particle(i).Cost;
particle(i).Best.Sol=particle(i).Sol;
% Update Global Best
if particle(i).Best.Cost<GlobalBest.Cost
GlobalBest=particle(i).Best;
end
end
BestCost=zeros(MaxIt,1);
%% PSO Main Loop
for it=1:MaxIt
for i=1:nPop
% Update Velocity
particle(i).Velocity = w*particle(i).Velocity …
+c1*rand(VarSize).*(particle(i).Best.Position-particle(i).Position) …
+c2*rand(VarSize).*(GlobalBest.Position-particle(i).Position);
% Apply Velocity Limits
particle(i).Velocity = max(particle(i).Velocity,VelMin);
particle(i).Velocity = min(particle(i).Velocity,VelMax);
% Update Position
particle(i).Position = particle(i).Position + particle(i).Velocity;
% Velocity Mirror Effect
IsOutside=(particle(i).Position<VarMin | particle(i).Position>VarMax);
particle(i).Velocity(IsOutside)=-particle(i).Velocity(IsOutside);
% Apply Position Limits
particle(i).Position = max(particle(i).Position,VarMin);
particle(i).Position = min(particle(i).Position,VarMax);
% Evaluation
[particle(i).Cost, particle(i).Sol] = CostFunction(particle(i).Position);
% Perform Mutation
for j=1:nParticleMutation
NewParticle = particle(i);
NewParticle.Position = Mutate(particle(i).Position);
[NewParticle.Cost, NewParticle.Sol] = CostFunction(NewParticle.Position);
if NewParticle.Cost <= particle(i).Cost
particle(i) = NewParticle;
end
end
% Update Personal Best
if particle(i).Cost<particle(i).Best.Cost
particle(i).Best.Position=particle(i).Position;
particle(i).Best.Cost=particle(i).Cost;
particle(i).Best.Sol=particle(i).Sol;
% Update Global Best
if particle(i).Best.Cost<GlobalBest.Cost
GlobalBest=particle(i).Best;
end
end
end
% Perform Mutation on Global Best
for i=1:nGlobalBestMutation
NewParticle = GlobalBest;
NewParticle.Position = Mutate(GlobalBest.Position);
[NewParticle.Cost, NewParticle.Sol] = CostFunction(NewParticle.Position);
if NewParticle.Cost <= GlobalBest.Cost
GlobalBest = NewParticle;
end
end
BestCost(it)=GlobalBest.Cost;
disp([‘Iteration ‘ num2str(it) ‘: Best Cost = ‘ num2str(BestCost(it))]);
w=w*wdamp;
end
BestSol = GlobalBest;
%% Results
figure;
plot(BestCost,’LineWidth’,2);
xlabel(‘Iteration’);
ylabel(‘Best Cost’);
grid on;
i got this algorithm from https://www.mathworks.com/matlabcentral/fileexchange/53111-bin-packing-problem-using-ga-pso-fa-and-iwo How do I get the 3D visualization of items in the bin from this algorithm?
%
% Copyright (c) 2015, Yarpiz (www.yarpiz.com)
% All rights reserved. Please read the "license.txt" for license terms.
%
% Project Code: YPAP105
% Project Title: Solving Bin Packing Problem using PSO, FA and IWO
% Publisher: Yarpiz (www.yarpiz.com)
%
% Developer: S. Mostapha Kalami Heris (Member of Yarpiz Team)
%
% Contact Info: sm.kalami@gmail.com, info@yarpiz.com
%
clc;
clear;
close all;
%% Problem Definition
model = CreateModel(); % Create Bin Packing Model
CostFunction = @(x) BinPackingCost(x, model); % Objective Function
nVar = 2*model.n-1; % Number of Decision Variables
VarSize = [1 nVar]; % Decision Variables Matrix Size
VarMin = 0; % Lower Bound of Decision Variables
VarMax = 1; % Upper Bound of Decision Variables
%% PSO Parameters
MaxIt=50; % Maximum Number of Iterations
nPop=20; % Population Size (Swarm Size)
% PSO Parameters
w=1; % Inertia Weight
wdamp=0.99; % Inertia Weight Damping Ratio
c1=1.5; % Personal Learning Coefficient
c2=2.0; % Global Learning Coefficient
% If you would like to use Constriction Coefficients for PSO,
% uncomment the following block and comment the above set of parameters.
% % Constriction Coefficients
% phi1=2.05;
% phi2=2.05;
% phi=phi1+phi2;
% chi=2/(phi-2+sqrt(phi^2-4*phi));
% w=chi; % Inertia Weight
% wdamp=1; % Inertia Weight Damping Ratio
% c1=chi*phi1; % Personal Learning Coefficient
% c2=chi*phi2; % Global Learning Coefficient
% Velocity Limits
VelMax=0.1*(VarMax-VarMin);
VelMin=-VelMax;
nParticleMutation = 2; % Number of Mutations Performed on Each Particle
nGlobalBestMutation = 5; % Number of Mutations Performed on Global Best
%% Initialization
empty_particle.Position=[];
empty_particle.Cost=[];
empty_particle.Sol=[];
empty_particle.Velocity=[];
empty_particle.Best.Position=[];
empty_particle.Best.Cost=[];
empty_particle.Best.Sol=[];
particle=repmat(empty_particle,nPop,1);
GlobalBest.Cost=inf;
for i=1:nPop
% Initialize Position
particle(i).Position=unifrnd(VarMin,VarMax,VarSize);
% Initialize Velocity
particle(i).Velocity=zeros(VarSize);
% Evaluation
[particle(i).Cost, particle(i).Sol]=CostFunction(particle(i).Position);
% Update Personal Best
particle(i).Best.Position=particle(i).Position;
particle(i).Best.Cost=particle(i).Cost;
particle(i).Best.Sol=particle(i).Sol;
% Update Global Best
if particle(i).Best.Cost<GlobalBest.Cost
GlobalBest=particle(i).Best;
end
end
BestCost=zeros(MaxIt,1);
%% PSO Main Loop
for it=1:MaxIt
for i=1:nPop
% Update Velocity
particle(i).Velocity = w*particle(i).Velocity …
+c1*rand(VarSize).*(particle(i).Best.Position-particle(i).Position) …
+c2*rand(VarSize).*(GlobalBest.Position-particle(i).Position);
% Apply Velocity Limits
particle(i).Velocity = max(particle(i).Velocity,VelMin);
particle(i).Velocity = min(particle(i).Velocity,VelMax);
% Update Position
particle(i).Position = particle(i).Position + particle(i).Velocity;
% Velocity Mirror Effect
IsOutside=(particle(i).Position<VarMin | particle(i).Position>VarMax);
particle(i).Velocity(IsOutside)=-particle(i).Velocity(IsOutside);
% Apply Position Limits
particle(i).Position = max(particle(i).Position,VarMin);
particle(i).Position = min(particle(i).Position,VarMax);
% Evaluation
[particle(i).Cost, particle(i).Sol] = CostFunction(particle(i).Position);
% Perform Mutation
for j=1:nParticleMutation
NewParticle = particle(i);
NewParticle.Position = Mutate(particle(i).Position);
[NewParticle.Cost, NewParticle.Sol] = CostFunction(NewParticle.Position);
if NewParticle.Cost <= particle(i).Cost
particle(i) = NewParticle;
end
end
% Update Personal Best
if particle(i).Cost<particle(i).Best.Cost
particle(i).Best.Position=particle(i).Position;
particle(i).Best.Cost=particle(i).Cost;
particle(i).Best.Sol=particle(i).Sol;
% Update Global Best
if particle(i).Best.Cost<GlobalBest.Cost
GlobalBest=particle(i).Best;
end
end
end
% Perform Mutation on Global Best
for i=1:nGlobalBestMutation
NewParticle = GlobalBest;
NewParticle.Position = Mutate(GlobalBest.Position);
[NewParticle.Cost, NewParticle.Sol] = CostFunction(NewParticle.Position);
if NewParticle.Cost <= GlobalBest.Cost
GlobalBest = NewParticle;
end
end
BestCost(it)=GlobalBest.Cost;
disp([‘Iteration ‘ num2str(it) ‘: Best Cost = ‘ num2str(BestCost(it))]);
w=w*wdamp;
end
BestSol = GlobalBest;
%% Results
figure;
plot(BestCost,’LineWidth’,2);
xlabel(‘Iteration’);
ylabel(‘Best Cost’);
grid on;
i got this algorithm from https://www.mathworks.com/matlabcentral/fileexchange/53111-bin-packing-problem-using-ga-pso-fa-and-iwo pso, particle swarm optimization, 3d plots, bin packing, matlab, algorithm MATLAB Answers — New Questions