Month: May 2025
closed countour around a given point
Hi and I’d like to say thanks in advance.
I am processing some gridded data using contour/countourc commands and I am trying to do 3 things.
find all the closed countours that are centered and suround a given x,y cordinate
find the outermost closed countour from the above list
find the maximum, min and average distance of the above outermost contour from the center x,y cordinate (countours are not always circular and may be of irregular shape in my data).
I started with a sample data (from matlab called peaks) to build my code and impliment on my actual data but I am still stuck on 1 and 2.
(image attaced) I want my code to detect contour levels 18, 16, 14, 12 which are closed and surrounding my center point (blue dot) but instead it is picking 8, 10, 14, 16, 18. How can i modify the code to only detect the prefered contour levels (18,16,14,12) from which i can find the outermost contour and the 3 distances from the center. Note, level 18 is behind the center dot. Also attached countour z data… just incase
%___________________________________________________________________________
% Specify the center point and search radius
centerPoint = [25, 37.5];
searchRadius = 20;
% get and plot contour data
Z = peaks+10; % make colorbar positive. using built in sample data from matlab (peaks)
[M,h] = contour(Z);
clabel(M, h);
colorbar
% plot centerPoint
hold on
scatter(25, 37.5,"filled")
hold off
% crop portion of search area for easy visual
xlim([25 – searchRadius 25 + searchRadius])
ylim([37.5 – searchRadius 37.5 + searchRadius])
%___________________________________________________________________________
% Calculate contours
contourData = contourc(Z);
% Parse contour data
idx = 1;
while idx < size(contourData, 2)
contourLevel = contourData(1, idx); % Contour level
numPoints = contourData(2, idx); % Number of points in the contour
contourPoints = contourData(:, idx+1:idx+numPoints); % Contour points (x, y coordinates)
% Check if contour is closed (first and last points are the same)
isClosed = isequal(contourPoints(:,1), contourPoints(:,end));
% Check if contour surrounds the specified point
if isClosed
% Calculate distance of contour points to center point
distToCenter = sqrt((contourPoints(1, 🙂 – centerPoint(1)).^2 + (contourPoints(2, 🙂 – centerPoint(2)).^2);
% Check if all points are within search radius
if all(distToCenter <= searchRadius)
disp([‘Contour Level: ‘, num2str(contourLevel)]);
disp([‘Contour is closed and surrounds point (‘, num2str(centerPoint(1)), ‘, ‘, num2str(centerPoint(2)), ‘)’]);
disp(‘Contour Points:’);
%disp(contourPoints);
disp(‘———————————————‘);
end
end
% Move to the next contour
idx = idx + numPoints + 1;
end
clear Z M h contourData contourLevel numPoints contourPoints …
centerPoint searchRadius contourLevels isClosed distToCenter idx;Hi and I’d like to say thanks in advance.
I am processing some gridded data using contour/countourc commands and I am trying to do 3 things.
find all the closed countours that are centered and suround a given x,y cordinate
find the outermost closed countour from the above list
find the maximum, min and average distance of the above outermost contour from the center x,y cordinate (countours are not always circular and may be of irregular shape in my data).
I started with a sample data (from matlab called peaks) to build my code and impliment on my actual data but I am still stuck on 1 and 2.
(image attaced) I want my code to detect contour levels 18, 16, 14, 12 which are closed and surrounding my center point (blue dot) but instead it is picking 8, 10, 14, 16, 18. How can i modify the code to only detect the prefered contour levels (18,16,14,12) from which i can find the outermost contour and the 3 distances from the center. Note, level 18 is behind the center dot. Also attached countour z data… just incase
%___________________________________________________________________________
% Specify the center point and search radius
centerPoint = [25, 37.5];
searchRadius = 20;
% get and plot contour data
Z = peaks+10; % make colorbar positive. using built in sample data from matlab (peaks)
[M,h] = contour(Z);
clabel(M, h);
colorbar
% plot centerPoint
hold on
scatter(25, 37.5,"filled")
hold off
% crop portion of search area for easy visual
xlim([25 – searchRadius 25 + searchRadius])
ylim([37.5 – searchRadius 37.5 + searchRadius])
%___________________________________________________________________________
% Calculate contours
contourData = contourc(Z);
% Parse contour data
idx = 1;
while idx < size(contourData, 2)
contourLevel = contourData(1, idx); % Contour level
numPoints = contourData(2, idx); % Number of points in the contour
contourPoints = contourData(:, idx+1:idx+numPoints); % Contour points (x, y coordinates)
% Check if contour is closed (first and last points are the same)
isClosed = isequal(contourPoints(:,1), contourPoints(:,end));
% Check if contour surrounds the specified point
if isClosed
% Calculate distance of contour points to center point
distToCenter = sqrt((contourPoints(1, 🙂 – centerPoint(1)).^2 + (contourPoints(2, 🙂 – centerPoint(2)).^2);
% Check if all points are within search radius
if all(distToCenter <= searchRadius)
disp([‘Contour Level: ‘, num2str(contourLevel)]);
disp([‘Contour is closed and surrounds point (‘, num2str(centerPoint(1)), ‘, ‘, num2str(centerPoint(2)), ‘)’]);
disp(‘Contour Points:’);
%disp(contourPoints);
disp(‘———————————————‘);
end
end
% Move to the next contour
idx = idx + numPoints + 1;
end
clear Z M h contourData contourLevel numPoints contourPoints …
centerPoint searchRadius contourLevels isClosed distToCenter idx; Hi and I’d like to say thanks in advance.
I am processing some gridded data using contour/countourc commands and I am trying to do 3 things.
find all the closed countours that are centered and suround a given x,y cordinate
find the outermost closed countour from the above list
find the maximum, min and average distance of the above outermost contour from the center x,y cordinate (countours are not always circular and may be of irregular shape in my data).
I started with a sample data (from matlab called peaks) to build my code and impliment on my actual data but I am still stuck on 1 and 2.
(image attaced) I want my code to detect contour levels 18, 16, 14, 12 which are closed and surrounding my center point (blue dot) but instead it is picking 8, 10, 14, 16, 18. How can i modify the code to only detect the prefered contour levels (18,16,14,12) from which i can find the outermost contour and the 3 distances from the center. Note, level 18 is behind the center dot. Also attached countour z data… just incase
%___________________________________________________________________________
% Specify the center point and search radius
centerPoint = [25, 37.5];
searchRadius = 20;
% get and plot contour data
Z = peaks+10; % make colorbar positive. using built in sample data from matlab (peaks)
[M,h] = contour(Z);
clabel(M, h);
colorbar
% plot centerPoint
hold on
scatter(25, 37.5,"filled")
hold off
% crop portion of search area for easy visual
xlim([25 – searchRadius 25 + searchRadius])
ylim([37.5 – searchRadius 37.5 + searchRadius])
%___________________________________________________________________________
% Calculate contours
contourData = contourc(Z);
% Parse contour data
idx = 1;
while idx < size(contourData, 2)
contourLevel = contourData(1, idx); % Contour level
numPoints = contourData(2, idx); % Number of points in the contour
contourPoints = contourData(:, idx+1:idx+numPoints); % Contour points (x, y coordinates)
% Check if contour is closed (first and last points are the same)
isClosed = isequal(contourPoints(:,1), contourPoints(:,end));
% Check if contour surrounds the specified point
if isClosed
% Calculate distance of contour points to center point
distToCenter = sqrt((contourPoints(1, 🙂 – centerPoint(1)).^2 + (contourPoints(2, 🙂 – centerPoint(2)).^2);
% Check if all points are within search radius
if all(distToCenter <= searchRadius)
disp([‘Contour Level: ‘, num2str(contourLevel)]);
disp([‘Contour is closed and surrounds point (‘, num2str(centerPoint(1)), ‘, ‘, num2str(centerPoint(2)), ‘)’]);
disp(‘Contour Points:’);
%disp(contourPoints);
disp(‘———————————————‘);
end
end
% Move to the next contour
idx = idx + numPoints + 1;
end
clear Z M h contourData contourLevel numPoints contourPoints …
centerPoint searchRadius contourLevels isClosed distToCenter idx; contour MATLAB Answers — New Questions
How to expand a matrix and interpolate between values?
I have a .mat file that is a 3×2 array. The first column contains hourly data but I would like it to be seconds and interpolate the values in between.
An example would be:
Any help is very much appreciated.I have a .mat file that is a 3×2 array. The first column contains hourly data but I would like it to be seconds and interpolate the values in between.
An example would be:
Any help is very much appreciated. I have a .mat file that is a 3×2 array. The first column contains hourly data but I would like it to be seconds and interpolate the values in between.
An example would be:
Any help is very much appreciated. table, time, interpolation MATLAB Answers — New Questions
ros2bagreader unable to parse “metadata.yaml”
Hello, I am trying to open a mcap ros2 bag and I receive the following error:
Error using ros2bagreader (line 478)
Unable to parse "metadata.yaml" file in the specified folder path. Ensure that the YAML file is correctly formatted.
I am using matlab 2024b version.
Any advice on how to solve this issue?
Thank you,
AnnalisaHello, I am trying to open a mcap ros2 bag and I receive the following error:
Error using ros2bagreader (line 478)
Unable to parse "metadata.yaml" file in the specified folder path. Ensure that the YAML file is correctly formatted.
I am using matlab 2024b version.
Any advice on how to solve this issue?
Thank you,
Annalisa Hello, I am trying to open a mcap ros2 bag and I receive the following error:
Error using ros2bagreader (line 478)
Unable to parse "metadata.yaml" file in the specified folder path. Ensure that the YAML file is correctly formatted.
I am using matlab 2024b version.
Any advice on how to solve this issue?
Thank you,
Annalisa ros2bagreader metadata.yaml MATLAB Answers — New Questions
How to read the X,Y and Z coordinates from a TIFF image extracted into Matlab?
I have extracted a TIFF image into Matlab using the geotiff function [A, R] = geotiffread(filename). Now the image is stored for example in A. I want to extract the X,Y and Z coordinates from this image and plot it later using surf function. How do I achieve this?
Thanks for any inputs or pointersI have extracted a TIFF image into Matlab using the geotiff function [A, R] = geotiffread(filename). Now the image is stored for example in A. I want to extract the X,Y and Z coordinates from this image and plot it later using surf function. How do I achieve this?
Thanks for any inputs or pointers I have extracted a TIFF image into Matlab using the geotiff function [A, R] = geotiffread(filename). Now the image is stored for example in A. I want to extract the X,Y and Z coordinates from this image and plot it later using surf function. How do I achieve this?
Thanks for any inputs or pointers tiff image, xyz coordinates, surf function MATLAB Answers — New Questions
Help me get this shape on the masks
I have some masks and i want to create a shape like a freeform donut that will enclose the masks,
I have drawn by red and green of what i want.I have some masks and i want to create a shape like a freeform donut that will enclose the masks,
I have drawn by red and green of what i want. I have some masks and i want to create a shape like a freeform donut that will enclose the masks,
I have drawn by red and green of what i want. image processing, image segmentation, digital image processing, computer vision MATLAB Answers — New Questions
May 2025 Update for the Office 365 for IT Pros eBook
Monthly Update #119 Now Available for Subscribers to Download

The Office 365 for IT Pros writing team is proud to announce the availability of monthly update #119. Subscribers can download the updated files using the link in the receipt emailed to them when they bought Office 365 for IT Pros (2025 edition). The link always fetches the latest files. For more details about downloading updates, see our FAQ. Details about the changes in update #119 are in our change log.
Automating Microsoft 365 with PowerShell
Updated files are also available for the Automating Microsoft 365 with PowerShell eBook. We posted a note about update #11 a couple of days ago because we try to get this update out before focusing on the big book. Since then, we’ve added some more information, and the current version of the PowerShell book is 11.3.
The earlier post contained some information about bugs in V2.27 of the Microsoft Graph PowerShell SDK. More bugs have been reported since, and a common problem appears to be that the payload used to create or update objects “disappears” when the Graph SDK translates the cmdlet parameters into Graph API requests. There’s a batch of issues listed in the SDK GitHub repository, including a problem assigning licenses to user accounts. Collectively, the bugs make us believe that it’s not a good idea to update to V2.27. Stay with V2.25, which is the last solid release of the Microsoft Graph PowerShell SDK.
Copilot Wave 2 and the M365 Conference
A week ago, Microsoft announced Copilot Wave 2 spring release. The updates include new agents, a new agent store, better personalization, and Copilot notebooks. Having yet another notebook is a depressing thought. Maybe Microsoft could have integrated Copilot better into Loop or OneNote? Just a thought.
Next week, the Microsoft 365 “Community Conference” takes place in Las Vegas, NV. I won’t be there. My experience from last year’s event in Orlando confirmed my feeling that this isn’t a community conference at all. It’s dominated by Microsoft, who spend a lot of money for the privilege of branding, multiple keynotes, and many conference sessions. If it were a community event, there would be a higher percentage of sessions covering the experience of working with today’s products instead of marketing sessions about the future.
The other problem I have with the event is that it doesn’t cover all of Microsoft 365. This is an event deep in SharePoint Online, OneDrive for Business, and Teams, all covered with a rich coating of Copilot for Microsoft 365. There’s room for topics like Microsoft Mesh, Loop, Viva Connections, Power Pages, and Viva Engage, but other parts of Microsoft 365 are excluded because they are not part of the sponsoring business unit. A strong impression is that the conference organizers believe that everyone will write agents and everyone has Copilot for Microsoft 365, and that’s not reality. But organizers will do what sponsors want.
If you attend the conference, don’t expect to hear much about the Microsoft 365 substrate, Exchange Online, Entra ID, Intune, Sentinel, Microsoft Defender, the Microsoft Graph, and PowerShell, all of which play important roles in a Microsoft 365 deployment. Success with SharePoint Online and Teams only happens when tenants are built on a strong and secure foundation, and I think this conference completely misses that point. The organizers will plead that they can only schedule the sessions submitted for consideration. That’s not true. It’s always possible for conferences to find speakers to cover important topics (I’ve done this several times).
I’m sure that the conference attendees will have a fun time in Vegas. It’s always nice to get away from the office to focus on new things. It’s just sad when a major conference purporting to cover Microsoft 365 does such a poor job of covering the essentials.
Back to Writing
Returning to Office 365 for IT Pros, where we do our level best to cover all the important pieces in a Microsoft 365 infrastructure, we’re working on update #120 for the Office 365 for IT Pros eBook, which we plan to make available on June 1, 2025. Have a great May!