Category: News
Can I update my Matlab behavior
Sorry for the poor title, not sure how to explain it.
I have two questions:
1) When we write three dots to split a command line, can we change what happens?
examplepath = ‘thisisapath’; % This is a random string
examplepath = [‘thisisa…’ …
‘path’]; % this is the same string if I write three dots "…" somewhere
% This is a bad behavior because it breaks the string
%% What I want Matlab to do when I write three dots:
examplepath = [‘thisisa’, …
‘path’];
This is what I want to do when I write three dots and press enter, I want to split whatever I wrote so it fits on 2 lines and I don’t have to use the horizontal slider bar because my sentence is too long. Is it be possible to update such behavior?
2) Indentation changed a few versions ago, I now use 2023a.
If I have a loop for example, when I paste code to it, I want it to be indented where it should be by default, not at the begining of the line. Example:
for i = 1:10
% something I wrote here here
% someting I pasted
end
%% It should be:
for i = 1:10
% something I wrote here here
% someting I pasted
end
It would be great to save these selection + ctrl+i, clicking at a random place inside a loop before was giving you an indented space, I want the same behavior.
Thanks!Sorry for the poor title, not sure how to explain it.
I have two questions:
1) When we write three dots to split a command line, can we change what happens?
examplepath = ‘thisisapath’; % This is a random string
examplepath = [‘thisisa…’ …
‘path’]; % this is the same string if I write three dots "…" somewhere
% This is a bad behavior because it breaks the string
%% What I want Matlab to do when I write three dots:
examplepath = [‘thisisa’, …
‘path’];
This is what I want to do when I write three dots and press enter, I want to split whatever I wrote so it fits on 2 lines and I don’t have to use the horizontal slider bar because my sentence is too long. Is it be possible to update such behavior?
2) Indentation changed a few versions ago, I now use 2023a.
If I have a loop for example, when I paste code to it, I want it to be indented where it should be by default, not at the begining of the line. Example:
for i = 1:10
% something I wrote here here
% someting I pasted
end
%% It should be:
for i = 1:10
% something I wrote here here
% someting I pasted
end
It would be great to save these selection + ctrl+i, clicking at a random place inside a loop before was giving you an indented space, I want the same behavior.
Thanks! Sorry for the poor title, not sure how to explain it.
I have two questions:
1) When we write three dots to split a command line, can we change what happens?
examplepath = ‘thisisapath’; % This is a random string
examplepath = [‘thisisa…’ …
‘path’]; % this is the same string if I write three dots "…" somewhere
% This is a bad behavior because it breaks the string
%% What I want Matlab to do when I write three dots:
examplepath = [‘thisisa’, …
‘path’];
This is what I want to do when I write three dots and press enter, I want to split whatever I wrote so it fits on 2 lines and I don’t have to use the horizontal slider bar because my sentence is too long. Is it be possible to update such behavior?
2) Indentation changed a few versions ago, I now use 2023a.
If I have a loop for example, when I paste code to it, I want it to be indented where it should be by default, not at the begining of the line. Example:
for i = 1:10
% something I wrote here here
% someting I pasted
end
%% It should be:
for i = 1:10
% something I wrote here here
% someting I pasted
end
It would be great to save these selection + ctrl+i, clicking at a random place inside a loop before was giving you an indented space, I want the same behavior.
Thanks! behavior MATLAB Answers — New Questions
Gathering Data from Excel Fillable Form into One Master Spreadsheet
Hello,
I am not sure if this has been done or if even possible, but I figured I’d ask. We sent out a fillable form that was created in excel for multiple people to fill out. They then email this form back. The issue I am having is trying to find a way to pull data from these forms into one master spreadsheet. Currently, we manually enter this data into a master spreadsheet, but I wasn’t sure if there was a way to make this less painful. In short, wanting to gather data from multiple forms (same format, different answers) and compile it into a single spreadsheet.
Hello, I am not sure if this has been done or if even possible, but I figured I’d ask. We sent out a fillable form that was created in excel for multiple people to fill out. They then email this form back. The issue I am having is trying to find a way to pull data from these forms into one master spreadsheet. Currently, we manually enter this data into a master spreadsheet, but I wasn’t sure if there was a way to make this less painful. In short, wanting to gather data from multiple forms (same format, different answers) and compile it into a single spreadsheet. Read More
Replace certain columns in a structure array
Hi. I have a structure array, Data, of size (1 x120). The 5th column of the field Data.Temp contains zeroes. I want to replace these zeroes with a number 20 from Data(30).Temp to Data(60).Temp. Also, I want to replace these zeroes from Data(61).Temp to Data(80).Temp with a number 24. I am unable to perform this operation. I kindly request some help from the community.Hi. I have a structure array, Data, of size (1 x120). The 5th column of the field Data.Temp contains zeroes. I want to replace these zeroes with a number 20 from Data(30).Temp to Data(60).Temp. Also, I want to replace these zeroes from Data(61).Temp to Data(80).Temp with a number 24. I am unable to perform this operation. I kindly request some help from the community. Hi. I have a structure array, Data, of size (1 x120). The 5th column of the field Data.Temp contains zeroes. I want to replace these zeroes with a number 20 from Data(30).Temp to Data(60).Temp. Also, I want to replace these zeroes from Data(61).Temp to Data(80).Temp with a number 24. I am unable to perform this operation. I kindly request some help from the community. structure array, array, cell MATLAB Answers — New Questions
Get coordinates of points from an image
Hello,
I would like to know how to obtain the coordinates of p number of random points from an image:
how to call an image ( do i have to specify the path of the folder and how?)
How to obtain the data of x axix and y axis corresponding to it
Shall i use the function getimage?
Thank youHello,
I would like to know how to obtain the coordinates of p number of random points from an image:
how to call an image ( do i have to specify the path of the folder and how?)
How to obtain the data of x axix and y axis corresponding to it
Shall i use the function getimage?
Thank you Hello,
I would like to know how to obtain the coordinates of p number of random points from an image:
how to call an image ( do i have to specify the path of the folder and how?)
How to obtain the data of x axix and y axis corresponding to it
Shall i use the function getimage?
Thank you getimage, coordinates, image, data MATLAB Answers — New Questions
how to remove areas of an image containing a single color?
I have a video that I saved each frame from. The entire video has static text in big white font and it doesnt move so each frame looks very similar. Each frame also has a black background like I want to remove. Is there a way for me to remove any pixle that is (0,0,0) or (1, 1, 1) RGB? Thanks!
heres an example image that I want to crop. I want to crop all of the black and all of the white.I have a video that I saved each frame from. The entire video has static text in big white font and it doesnt move so each frame looks very similar. Each frame also has a black background like I want to remove. Is there a way for me to remove any pixle that is (0,0,0) or (1, 1, 1) RGB? Thanks!
heres an example image that I want to crop. I want to crop all of the black and all of the white. I have a video that I saved each frame from. The entire video has static text in big white font and it doesnt move so each frame looks very similar. Each frame also has a black background like I want to remove. Is there a way for me to remove any pixle that is (0,0,0) or (1, 1, 1) RGB? Thanks!
heres an example image that I want to crop. I want to crop all of the black and all of the white. image processing MATLAB Answers — New Questions
Programmatically Disable a Toolbox
I have an external toolbox (created by me) and I want to disable it (not uninstall it), do some stuff, and then re-enable it.
I have looked through the available methods in matlab.addons.toolbox, but I only see options for installing and uninstalling.
Looking at other ideas, removing the paths would be a way to disable the toolbox, but how do I know (programatically) what paths to remove? Looking in the Add-Ons explorer I can see the paths associated with the toolbox and I have an option to diasble it, but I can’t get either of those through the matlab.addons.toolbox API.
I think I either need a way to get the paths for the toolbox, or I need a method that allows me to disable it.
Am I missing something that exists today to do this?I have an external toolbox (created by me) and I want to disable it (not uninstall it), do some stuff, and then re-enable it.
I have looked through the available methods in matlab.addons.toolbox, but I only see options for installing and uninstalling.
Looking at other ideas, removing the paths would be a way to disable the toolbox, but how do I know (programatically) what paths to remove? Looking in the Add-Ons explorer I can see the paths associated with the toolbox and I have an option to diasble it, but I can’t get either of those through the matlab.addons.toolbox API.
I think I either need a way to get the paths for the toolbox, or I need a method that allows me to disable it.
Am I missing something that exists today to do this? I have an external toolbox (created by me) and I want to disable it (not uninstall it), do some stuff, and then re-enable it.
I have looked through the available methods in matlab.addons.toolbox, but I only see options for installing and uninstalling.
Looking at other ideas, removing the paths would be a way to disable the toolbox, but how do I know (programatically) what paths to remove? Looking in the Add-Ons explorer I can see the paths associated with the toolbox and I have an option to diasble it, but I can’t get either of those through the matlab.addons.toolbox API.
I think I either need a way to get the paths for the toolbox, or I need a method that allows me to disable it.
Am I missing something that exists today to do this? toolbox, disable, toolbox paths MATLAB Answers — New Questions
View Original Email Issue
Myself and other members of our office are having difficulty with the “View Original Email” option when receiving emails in Teams. It might work once, but then it will stop and we have to close teams entirely and start again to open another, and even then sometimes it won’t work. Does anyone have any suggestions as to how we can make this work, as we are having difficulty replying to our customers on a regular basis. Thanks in advance.
Myself and other members of our office are having difficulty with the “View Original Email” option when receiving emails in Teams. It might work once, but then it will stop and we have to close teams entirely and start again to open another, and even then sometimes it won’t work. Does anyone have any suggestions as to how we can make this work, as we are having difficulty replying to our customers on a regular basis. Thanks in advance. Read More
Customer isn’t receiving a meeting invite
I added the link to Bookings to the bottom of my website https://www.missteams365.com/
Customers who book from my website aren’t receiving a meeting invite even though their email is a required field.
The appointment shows up on my calendar, and it says I’m the organizer. I’m unable to forward the invite or change the meeting.
I added the link to Bookings to the bottom of my website https://www.missteams365.com/ Customers who book from my website aren’t receiving a meeting invite even though their email is a required field. The appointment shows up on my calendar, and it says I’m the organizer. I’m unable to forward the invite or change the meeting. Read More
Create a simulink model fro, python
Hello,
I would like to create an algorithm using evolutionnary strategies in order to identify physical systems represented by block diagrams. To do so, I will need to design an algorithm where a population of systems is modified (not only the parameters but also the structure) and tested at each iteration. I need to simulate the resulting population and in order to do that I need to be able to change one block of the model in simulink, which would be a sub system with different transfer functions. I don’t know simulink very well so is there a way to crate a custom block, to simulate the model from python and to change one part of the model at each run?
Thank you in advance,Hello,
I would like to create an algorithm using evolutionnary strategies in order to identify physical systems represented by block diagrams. To do so, I will need to design an algorithm where a population of systems is modified (not only the parameters but also the structure) and tested at each iteration. I need to simulate the resulting population and in order to do that I need to be able to change one block of the model in simulink, which would be a sub system with different transfer functions. I don’t know simulink very well so is there a way to crate a custom block, to simulate the model from python and to change one part of the model at each run?
Thank you in advance, Hello,
I would like to create an algorithm using evolutionnary strategies in order to identify physical systems represented by block diagrams. To do so, I will need to design an algorithm where a population of systems is modified (not only the parameters but also the structure) and tested at each iteration. I need to simulate the resulting population and in order to do that I need to be able to change one block of the model in simulink, which would be a sub system with different transfer functions. I don’t know simulink very well so is there a way to crate a custom block, to simulate the model from python and to change one part of the model at each run?
Thank you in advance, simulink, python, optimization MATLAB Answers — New Questions
Nonlinear optimization with branching solution space
I would like to solve a nonlinear optimization problem with nonlinear constraints, in which the solution space branches, such that the relevant optimization parameters and their constraints depend upon the branch. In total the problem has 11 optimization parameters however not all parameters are possible together. The primary parameter is an integer ‘x’ = 1-10 (although it could be treated as a continuous variable). The error function f(x) depends also upon other parameters as follows. If x < 10 the error function is f(x, c, d = 0) where ‘c’ is 5 other continuous parameters with constraints, elseif x = 10 the error function is f(x, c = 0, d) where ‘d’ is 5 different continuous parameters with constraints.
It seems simplest to first solve for x assuming c = 0 and d = 0, then solve for ‘c and ‘d’ depending upon the branch, i.e., depending upon whether x < 10 or x = 10, however, those attempts have failed, because if ‘c’ or ‘d’ are nonzero, the data are affected and the solutions for x are incorrect.
Two questions please;
1) Is this problem even well-posed as stated?
2) Does optimization or global optimization have a tool that can solve this?I would like to solve a nonlinear optimization problem with nonlinear constraints, in which the solution space branches, such that the relevant optimization parameters and their constraints depend upon the branch. In total the problem has 11 optimization parameters however not all parameters are possible together. The primary parameter is an integer ‘x’ = 1-10 (although it could be treated as a continuous variable). The error function f(x) depends also upon other parameters as follows. If x < 10 the error function is f(x, c, d = 0) where ‘c’ is 5 other continuous parameters with constraints, elseif x = 10 the error function is f(x, c = 0, d) where ‘d’ is 5 different continuous parameters with constraints.
It seems simplest to first solve for x assuming c = 0 and d = 0, then solve for ‘c and ‘d’ depending upon the branch, i.e., depending upon whether x < 10 or x = 10, however, those attempts have failed, because if ‘c’ or ‘d’ are nonzero, the data are affected and the solutions for x are incorrect.
Two questions please;
1) Is this problem even well-posed as stated?
2) Does optimization or global optimization have a tool that can solve this? I would like to solve a nonlinear optimization problem with nonlinear constraints, in which the solution space branches, such that the relevant optimization parameters and their constraints depend upon the branch. In total the problem has 11 optimization parameters however not all parameters are possible together. The primary parameter is an integer ‘x’ = 1-10 (although it could be treated as a continuous variable). The error function f(x) depends also upon other parameters as follows. If x < 10 the error function is f(x, c, d = 0) where ‘c’ is 5 other continuous parameters with constraints, elseif x = 10 the error function is f(x, c = 0, d) where ‘d’ is 5 different continuous parameters with constraints.
It seems simplest to first solve for x assuming c = 0 and d = 0, then solve for ‘c and ‘d’ depending upon the branch, i.e., depending upon whether x < 10 or x = 10, however, those attempts have failed, because if ‘c’ or ‘d’ are nonzero, the data are affected and the solutions for x are incorrect.
Two questions please;
1) Is this problem even well-posed as stated?
2) Does optimization or global optimization have a tool that can solve this? optimization MATLAB Answers — New Questions
str2num is returning and empty matrix: []
Problem:
I’m trying to convert a string containing a number into a double, but the output of str2num keeps giving me an empty matrix [].
Context:
I’ve imported data from an excel sheet with importdata(). That data comes in as a cell array. To extract data from a specific cell, I use cell2mat(). This yeilds numbers in the class: Char. (Example: ‘5’). I use convertCharsToString(‘5’) to convert that character into a string. What I’m left with is ans = "5".
Now, I want to convert this "5" into a double. So, I used str2num(ans), and I get [] as the output (instead of 5 of class double).
I even tried this debugg:
a = "5";
strcmp(a,month)
and got a logical = 0…
Any ideas why this isn’t woking?Problem:
I’m trying to convert a string containing a number into a double, but the output of str2num keeps giving me an empty matrix [].
Context:
I’ve imported data from an excel sheet with importdata(). That data comes in as a cell array. To extract data from a specific cell, I use cell2mat(). This yeilds numbers in the class: Char. (Example: ‘5’). I use convertCharsToString(‘5’) to convert that character into a string. What I’m left with is ans = "5".
Now, I want to convert this "5" into a double. So, I used str2num(ans), and I get [] as the output (instead of 5 of class double).
I even tried this debugg:
a = "5";
strcmp(a,month)
and got a logical = 0…
Any ideas why this isn’t woking? Problem:
I’m trying to convert a string containing a number into a double, but the output of str2num keeps giving me an empty matrix [].
Context:
I’ve imported data from an excel sheet with importdata(). That data comes in as a cell array. To extract data from a specific cell, I use cell2mat(). This yeilds numbers in the class: Char. (Example: ‘5’). I use convertCharsToString(‘5’) to convert that character into a string. What I’m left with is ans = "5".
Now, I want to convert this "5" into a double. So, I used str2num(ans), and I get [] as the output (instead of 5 of class double).
I even tried this debugg:
a = "5";
strcmp(a,month)
and got a logical = 0…
Any ideas why this isn’t woking? str2num empty matrix string not working MATLAB Answers — New Questions
Niladri Das on Microsoft Azure, Dynamics 365 & Power Platform Newsletter – May 2024
Hey Microsoft Learn community!
As a fellow tech enthusiast, I’m excited to start a discussion on Microsoft Azure, Dynamics 365, and Power Platform. With the rapid evolution of these technologies, I believe it’s essential to share our experiences, insights, and knowledge with each other.
Table of Contents
IntroductionMicrosoft AzurePower PlatformMicrosoft Dynamics 365Microsoft 365Join the Conversation
Introduction
In this post, I will be discussing my experience with Azure, Power Platform, Dynamics 365, and Microsoft 365. I’m also curious to learn about other user’s experiences and projects.
Microsoft Azure
During my training, I used Azure to create a virtual machine with Ubuntu.What are your favorite Azure features or use cases?Have you worked on any interesting projects using Azure?
Power Platform
I have some understanding of Power BI and how to import Excel data into it.I’m curious to learn more about Power Apps and Power Automate.How have you used Power Platform in your projects?What are some tips and tricks for getting the most out of these tools?
Microsoft Dynamics 365
I have experience working with Dynamics 365 CRM.What are your favorite Dynamics 365 features or use cases?Have you worked on any interesting projects using Dynamics 365?
Microsoft 365
I’ve been using Microsoft 365 tools since my childhood days for painting, writing, and creating sheets and presentations.How do you use Microsoft 365 in your personal or professional life?What are some hidden gems in the Microsoft 365 suite that you’ve discovered?
Join the Conversation
So, what’s your story?What are you working on, or what do you want to learn more about?
Join the conversation!
Best, Niladri
Please feel free to ask any questions or share your experiences and insights with Microsoft Azure, Dynamics 365, Power Platform, and GitHub. I look forward to learning from and collaborating with you all!
Hey Microsoft Learn community! As a fellow tech enthusiast, I’m excited to start a discussion on Microsoft Azure, Dynamics 365, and Power Platform. With the rapid evolution of these technologies, I believe it’s essential to share our experiences, insights, and knowledge with each other. Table of ContentsIntroductionMicrosoft AzurePower PlatformMicrosoft Dynamics 365Microsoft 365Join the Conversation IntroductionIn this post, I will be discussing my experience with Azure, Power Platform, Dynamics 365, and Microsoft 365. I’m also curious to learn about other user’s experiences and projects. Microsoft AzureDuring my training, I used Azure to create a virtual machine with Ubuntu.What are your favorite Azure features or use cases?Have you worked on any interesting projects using Azure? Power PlatformI have some understanding of Power BI and how to import Excel data into it.I’m curious to learn more about Power Apps and Power Automate.How have you used Power Platform in your projects?What are some tips and tricks for getting the most out of these tools? Microsoft Dynamics 365I have experience working with Dynamics 365 CRM.What are your favorite Dynamics 365 features or use cases?Have you worked on any interesting projects using Dynamics 365? Microsoft 365I’ve been using Microsoft 365 tools since my childhood days for painting, writing, and creating sheets and presentations.How do you use Microsoft 365 in your personal or professional life?What are some hidden gems in the Microsoft 365 suite that you’ve discovered? Join the ConversationSo, what’s your story?What are you working on, or what do you want to learn more about? Join the conversation!Best, NiladriLinkedIn | GitHub Please feel free to ask any questions or share your experiences and insights with Microsoft Azure, Dynamics 365, Power Platform, and GitHub. I look forward to learning from and collaborating with you all! Read More
Images are rotated counter clockwise without any reason,
Hi,
So, I’m working on a code where I have a folder with 33 images and they are of different orientation (mix of landscape and portrait sizes). I have the script that reads the images from the folder and overlay gaze data on top of these images. The script is running fine except a small bug that im facing is that for final plot of 33 images, some images that are actually portrait size (elongated top to bottom) are plotted with counter clock-wise rotation to show it as a landscape.
The two images below are for reference. where Img x025 is correct plotted with right data but Img x033 is incorrect and its rotated and therefore the gaze data is correct but due to rotation, its not overlaid correctly.
I want the x033 image to look like this below and there are about 12-14 images that are displayed or showed in this way with wrong orientation:
The code is as follows, which is part of a larger script:
imageDir = ‘C:Usersmqs6680Downloadssaliency-masterimages1’;
% Load the data
filename = ‘DD2.tsv’;
opts = detectImportOptions(filename, ‘FileType’, ‘text’);
data = readtable(filename, opts);
% Get unique participants
participants = unique(data.(‘ParticipantName’));
% Initialize a structure for participants
participantData = struct();
% Get a list of all JPG files in the folder
imageFiles = dir(fullfile(imageDir, ‘*.jpg’));
% Read resolutions and store in a map for quick lookup
resolutions = containers.Map(‘KeyType’, ‘char’, ‘ValueType’, ‘any’);
for i = 1:length(imageFiles)
imagePath = fullfile(imageDir, imageFiles(i).name);
img = imread(imagePath);
resolution = [size(img, 1), size(img, 2)]; % [height, width]
[~, imageID, ~] = fileparts(imageFiles(i).name);
resolutions(imageID) = resolution;
end
% Now you can access each participant’s data and each image’s data using:
% participantData.participantName_var.imageName_var
%% Individual Fixation map
% Assuming participantData is already filled from previous code
% Get all participant names from the structure
participantNames = fieldnames(participantData);
% Prompt user to enter a participant name or choose from a list
disp(‘Available participants:’);
disp(participantNames);
selectedParticipant = input(‘Enter the name of the participant to plot (case-sensitive): ‘, ‘s’);
% Check if the entered participant name is valid
if isfield(participantData, selectedParticipant)
% Get all images for the selected participant
imageNames = fieldnames(participantData.(selectedParticipant));
for j = 1:length(imageNames)
imageName = imageNames{j};
imageData = participantData.(selectedParticipant).(imageName);
% Ensure data exists for plotting
if ~isempty(imageData)
actualFixationX = imageData.ActualFixationX;
actualFixationY = imageData.ActualFixationY;
% Read the image from the file
imagePath = fullfile(‘C:Usersmqs6680Downloadssaliency-masterimages’, strcat(imageName, ‘.jpg’)); % Assumes image extension is jpg
img = imread(imagePath);
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Correctly swap and calculate new fixation points
tempX = actualFixationX; % Temporary variable for swapping
actualFixationX = actualFixationY; % New X is the old Y
actualFixationY = size(img, 1) – tempX + 1; % New Y is adjusted based on the new image height
end
% Create a scatter plot on top of the image
figure; % Create a new figure for each image
imshow(img, ‘InitialMagnification’, ‘fit’); % Display the image and fit it to the window
hold on; % Hold on to overlay scatter plot on the image
scatter(actualFixationX, actualFixationY, ‘filled’, ‘r’); % Red points
hold off; % Release the hold to allow further plots to be displayed separately
title(sprintf(‘Fixation Points on Image for Participant: %s, Image: %s’, selectedParticipant, imageName));
xlabel(‘Actual Fixation X (pixels)’);
ylabel(‘Actual Fixation Y (pixels)’);
% Explicitly set the axis limits to match the image dimensions
axis on; % Turn on axis lines, optional
xlim([0 size(img, 2)]); % Set x-axis limits based on image width
ylim([0 size(img, 1)]); % Set y-axis limits based on image height
end
end
else
fprintf(‘No data available for participant: %sn’, selectedParticipant);
end
Also, I have tried following different debugging methods:
Method 1:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
newFixationX = size(img, 1) – actualFixationY + 1; % Recalibrate to the new dimensions
newFixationY = actualFixationX;
actualFixationX = newFixationX;
actualFixationY = newFixationY;
end
Method 2:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
[actualFixationX, actualFixationY] = deal(actualFixationY, size(img, 2) – actualFixationX + 1);
end
I have cut portion of the code where it was handling the gaze data related stuff. Anyhelp will be appreciated. Thank you so much.Hi,
So, I’m working on a code where I have a folder with 33 images and they are of different orientation (mix of landscape and portrait sizes). I have the script that reads the images from the folder and overlay gaze data on top of these images. The script is running fine except a small bug that im facing is that for final plot of 33 images, some images that are actually portrait size (elongated top to bottom) are plotted with counter clock-wise rotation to show it as a landscape.
The two images below are for reference. where Img x025 is correct plotted with right data but Img x033 is incorrect and its rotated and therefore the gaze data is correct but due to rotation, its not overlaid correctly.
I want the x033 image to look like this below and there are about 12-14 images that are displayed or showed in this way with wrong orientation:
The code is as follows, which is part of a larger script:
imageDir = ‘C:Usersmqs6680Downloadssaliency-masterimages1’;
% Load the data
filename = ‘DD2.tsv’;
opts = detectImportOptions(filename, ‘FileType’, ‘text’);
data = readtable(filename, opts);
% Get unique participants
participants = unique(data.(‘ParticipantName’));
% Initialize a structure for participants
participantData = struct();
% Get a list of all JPG files in the folder
imageFiles = dir(fullfile(imageDir, ‘*.jpg’));
% Read resolutions and store in a map for quick lookup
resolutions = containers.Map(‘KeyType’, ‘char’, ‘ValueType’, ‘any’);
for i = 1:length(imageFiles)
imagePath = fullfile(imageDir, imageFiles(i).name);
img = imread(imagePath);
resolution = [size(img, 1), size(img, 2)]; % [height, width]
[~, imageID, ~] = fileparts(imageFiles(i).name);
resolutions(imageID) = resolution;
end
% Now you can access each participant’s data and each image’s data using:
% participantData.participantName_var.imageName_var
%% Individual Fixation map
% Assuming participantData is already filled from previous code
% Get all participant names from the structure
participantNames = fieldnames(participantData);
% Prompt user to enter a participant name or choose from a list
disp(‘Available participants:’);
disp(participantNames);
selectedParticipant = input(‘Enter the name of the participant to plot (case-sensitive): ‘, ‘s’);
% Check if the entered participant name is valid
if isfield(participantData, selectedParticipant)
% Get all images for the selected participant
imageNames = fieldnames(participantData.(selectedParticipant));
for j = 1:length(imageNames)
imageName = imageNames{j};
imageData = participantData.(selectedParticipant).(imageName);
% Ensure data exists for plotting
if ~isempty(imageData)
actualFixationX = imageData.ActualFixationX;
actualFixationY = imageData.ActualFixationY;
% Read the image from the file
imagePath = fullfile(‘C:Usersmqs6680Downloadssaliency-masterimages’, strcat(imageName, ‘.jpg’)); % Assumes image extension is jpg
img = imread(imagePath);
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Correctly swap and calculate new fixation points
tempX = actualFixationX; % Temporary variable for swapping
actualFixationX = actualFixationY; % New X is the old Y
actualFixationY = size(img, 1) – tempX + 1; % New Y is adjusted based on the new image height
end
% Create a scatter plot on top of the image
figure; % Create a new figure for each image
imshow(img, ‘InitialMagnification’, ‘fit’); % Display the image and fit it to the window
hold on; % Hold on to overlay scatter plot on the image
scatter(actualFixationX, actualFixationY, ‘filled’, ‘r’); % Red points
hold off; % Release the hold to allow further plots to be displayed separately
title(sprintf(‘Fixation Points on Image for Participant: %s, Image: %s’, selectedParticipant, imageName));
xlabel(‘Actual Fixation X (pixels)’);
ylabel(‘Actual Fixation Y (pixels)’);
% Explicitly set the axis limits to match the image dimensions
axis on; % Turn on axis lines, optional
xlim([0 size(img, 2)]); % Set x-axis limits based on image width
ylim([0 size(img, 1)]); % Set y-axis limits based on image height
end
end
else
fprintf(‘No data available for participant: %sn’, selectedParticipant);
end
Also, I have tried following different debugging methods:
Method 1:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
newFixationX = size(img, 1) – actualFixationY + 1; % Recalibrate to the new dimensions
newFixationY = actualFixationX;
actualFixationX = newFixationX;
actualFixationY = newFixationY;
end
Method 2:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
[actualFixationX, actualFixationY] = deal(actualFixationY, size(img, 2) – actualFixationX + 1);
end
I have cut portion of the code where it was handling the gaze data related stuff. Anyhelp will be appreciated. Thank you so much. Hi,
So, I’m working on a code where I have a folder with 33 images and they are of different orientation (mix of landscape and portrait sizes). I have the script that reads the images from the folder and overlay gaze data on top of these images. The script is running fine except a small bug that im facing is that for final plot of 33 images, some images that are actually portrait size (elongated top to bottom) are plotted with counter clock-wise rotation to show it as a landscape.
The two images below are for reference. where Img x025 is correct plotted with right data but Img x033 is incorrect and its rotated and therefore the gaze data is correct but due to rotation, its not overlaid correctly.
I want the x033 image to look like this below and there are about 12-14 images that are displayed or showed in this way with wrong orientation:
The code is as follows, which is part of a larger script:
imageDir = ‘C:Usersmqs6680Downloadssaliency-masterimages1’;
% Load the data
filename = ‘DD2.tsv’;
opts = detectImportOptions(filename, ‘FileType’, ‘text’);
data = readtable(filename, opts);
% Get unique participants
participants = unique(data.(‘ParticipantName’));
% Initialize a structure for participants
participantData = struct();
% Get a list of all JPG files in the folder
imageFiles = dir(fullfile(imageDir, ‘*.jpg’));
% Read resolutions and store in a map for quick lookup
resolutions = containers.Map(‘KeyType’, ‘char’, ‘ValueType’, ‘any’);
for i = 1:length(imageFiles)
imagePath = fullfile(imageDir, imageFiles(i).name);
img = imread(imagePath);
resolution = [size(img, 1), size(img, 2)]; % [height, width]
[~, imageID, ~] = fileparts(imageFiles(i).name);
resolutions(imageID) = resolution;
end
% Now you can access each participant’s data and each image’s data using:
% participantData.participantName_var.imageName_var
%% Individual Fixation map
% Assuming participantData is already filled from previous code
% Get all participant names from the structure
participantNames = fieldnames(participantData);
% Prompt user to enter a participant name or choose from a list
disp(‘Available participants:’);
disp(participantNames);
selectedParticipant = input(‘Enter the name of the participant to plot (case-sensitive): ‘, ‘s’);
% Check if the entered participant name is valid
if isfield(participantData, selectedParticipant)
% Get all images for the selected participant
imageNames = fieldnames(participantData.(selectedParticipant));
for j = 1:length(imageNames)
imageName = imageNames{j};
imageData = participantData.(selectedParticipant).(imageName);
% Ensure data exists for plotting
if ~isempty(imageData)
actualFixationX = imageData.ActualFixationX;
actualFixationY = imageData.ActualFixationY;
% Read the image from the file
imagePath = fullfile(‘C:Usersmqs6680Downloadssaliency-masterimages’, strcat(imageName, ‘.jpg’)); % Assumes image extension is jpg
img = imread(imagePath);
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Correctly swap and calculate new fixation points
tempX = actualFixationX; % Temporary variable for swapping
actualFixationX = actualFixationY; % New X is the old Y
actualFixationY = size(img, 1) – tempX + 1; % New Y is adjusted based on the new image height
end
% Create a scatter plot on top of the image
figure; % Create a new figure for each image
imshow(img, ‘InitialMagnification’, ‘fit’); % Display the image and fit it to the window
hold on; % Hold on to overlay scatter plot on the image
scatter(actualFixationX, actualFixationY, ‘filled’, ‘r’); % Red points
hold off; % Release the hold to allow further plots to be displayed separately
title(sprintf(‘Fixation Points on Image for Participant: %s, Image: %s’, selectedParticipant, imageName));
xlabel(‘Actual Fixation X (pixels)’);
ylabel(‘Actual Fixation Y (pixels)’);
% Explicitly set the axis limits to match the image dimensions
axis on; % Turn on axis lines, optional
xlim([0 size(img, 2)]); % Set x-axis limits based on image width
ylim([0 size(img, 1)]); % Set y-axis limits based on image height
end
end
else
fprintf(‘No data available for participant: %sn’, selectedParticipant);
end
Also, I have tried following different debugging methods:
Method 1:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
newFixationX = size(img, 1) – actualFixationY + 1; % Recalibrate to the new dimensions
newFixationY = actualFixationX;
actualFixationX = newFixationX;
actualFixationY = newFixationY;
end
Method 2:
% Check if the image needs to be rotated (portrait orientation)
if size(img, 1) > size(img, 2)
img = imrotate(img, -90); % Rotate the image clockwise by 90 degrees
% Swap X and Y fixation points for the rotated image
[actualFixationX, actualFixationY] = deal(actualFixationY, size(img, 2) – actualFixationX + 1);
end
I have cut portion of the code where it was handling the gaze data related stuff. Anyhelp will be appreciated. Thank you so much. data import, plotting, image analysis MATLAB Answers — New Questions
graph multiple excel or csv files
I have 4 excel files, which I would like to join using matlab into a single file like example 5 (but not convert it to excel). But using the time table command in which the date and time are combined, the purpose is to be able to graph various amounts of data quickly without graphing each file.
The purpose is when you have to graph excel or csv files to be able to generate them quickly
For example:
I really appreciate the help.
My code actual:
clear;
clc;
%% Load and plot data example 01
filename = ‘example1’;
T = readtable(filename);
x1 = T{:,1} + days(T{:,2}); % Combining date and time
y1 = T{:,3}; % Pressure data
figure
plot(x1, y1, ‘r-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 02
filename = ‘example2’;
T = readtable(filename);
x2 = T{:,1} + days(T{:,2}); % Combining date and time
y2= T{:,3}; % Pressure data
plot(x2, y2, ‘b-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 03
filename = ‘example3’;
T = readtable(filename);
x3 = T{:,1} + days(T{:,2}); % Combining date and time
y3= T{:,3}; % Pressure data
plot(x3, y3, ‘g-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 04
filename = ‘example4’;
T = readtable(filename);
x4 = T{:,1} + days(T{:,2}); % Combining date and time
y4= T{:,3}; % Pressure data
plot(x4, y4, ‘k-‘, ‘LineWidth’, 1)
hold on
grid on
axis tightI have 4 excel files, which I would like to join using matlab into a single file like example 5 (but not convert it to excel). But using the time table command in which the date and time are combined, the purpose is to be able to graph various amounts of data quickly without graphing each file.
The purpose is when you have to graph excel or csv files to be able to generate them quickly
For example:
I really appreciate the help.
My code actual:
clear;
clc;
%% Load and plot data example 01
filename = ‘example1’;
T = readtable(filename);
x1 = T{:,1} + days(T{:,2}); % Combining date and time
y1 = T{:,3}; % Pressure data
figure
plot(x1, y1, ‘r-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 02
filename = ‘example2’;
T = readtable(filename);
x2 = T{:,1} + days(T{:,2}); % Combining date and time
y2= T{:,3}; % Pressure data
plot(x2, y2, ‘b-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 03
filename = ‘example3’;
T = readtable(filename);
x3 = T{:,1} + days(T{:,2}); % Combining date and time
y3= T{:,3}; % Pressure data
plot(x3, y3, ‘g-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 04
filename = ‘example4’;
T = readtable(filename);
x4 = T{:,1} + days(T{:,2}); % Combining date and time
y4= T{:,3}; % Pressure data
plot(x4, y4, ‘k-‘, ‘LineWidth’, 1)
hold on
grid on
axis tight I have 4 excel files, which I would like to join using matlab into a single file like example 5 (but not convert it to excel). But using the time table command in which the date and time are combined, the purpose is to be able to graph various amounts of data quickly without graphing each file.
The purpose is when you have to graph excel or csv files to be able to generate them quickly
For example:
I really appreciate the help.
My code actual:
clear;
clc;
%% Load and plot data example 01
filename = ‘example1’;
T = readtable(filename);
x1 = T{:,1} + days(T{:,2}); % Combining date and time
y1 = T{:,3}; % Pressure data
figure
plot(x1, y1, ‘r-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 02
filename = ‘example2’;
T = readtable(filename);
x2 = T{:,1} + days(T{:,2}); % Combining date and time
y2= T{:,3}; % Pressure data
plot(x2, y2, ‘b-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 03
filename = ‘example3’;
T = readtable(filename);
x3 = T{:,1} + days(T{:,2}); % Combining date and time
y3= T{:,3}; % Pressure data
plot(x3, y3, ‘g-‘, ‘LineWidth’, 1)
hold on
%% Load and plot data example 04
filename = ‘example4’;
T = readtable(filename);
x4 = T{:,1} + days(T{:,2}); % Combining date and time
y4= T{:,3}; % Pressure data
plot(x4, y4, ‘k-‘, ‘LineWidth’, 1)
hold on
grid on
axis tight multiple files, graphics, plot MATLAB Answers — New Questions
Outlook 365 Calendar View
Is it possible to change the default view in Outlook 365 Calendar to display 4 weeks and not the 5 week “Month View?”
Is it possible to change the default view in Outlook 365 Calendar to display 4 weeks and not the 5 week “Month View?” Read More
Viewing Risks in Project Online
Hi All,
We are formulating risks on our projects, but I am confused about the permissions. I can see all risks as the Project owner and the project manager assigned on the summary page of the project. But others can only see the risks assigned to them.
How do I allow everyone to see the full list of risks?
Hi All, We are formulating risks on our projects, but I am confused about the permissions. I can see all risks as the Project owner and the project manager assigned on the summary page of the project. But others can only see the risks assigned to them.How do I allow everyone to see the full list of risks? Read More
Remote Connection Manager (RDMon)
For those who use Remote Desktop Connection Manager, v2.93
I’m trying to utilize the feature of Hot Keys.
From the menu -> Tools -> Options -> Hot Keys (tab) -> Previous session.
I use the ctrl-alt-insert for full screen all the time.
Problem is the ctrl-alt-rightarrow / left arrow are not working.
I’m expecting it to cycle to the next open VM.
I’ve used this in the past but now it doesn’t seem to work anymore.
For those who use Remote Desktop Connection Manager, v2.93 I’m trying to utilize the feature of Hot Keys.From the menu -> Tools -> Options -> Hot Keys (tab) -> Previous session.I use the ctrl-alt-insert for full screen all the time.Problem is the ctrl-alt-rightarrow / left arrow are not working.I’m expecting it to cycle to the next open VM. I’ve used this in the past but now it doesn’t seem to work anymore. Read More
Moving Teams Android Devices to AOSP Device Management
We are pleased to announce that Microsoft Teams Android devices will be moving to Intune Android Open Source Project (AOSP) device management later this year. AOSP device management will be the mobile device management (MDM) platform for Teams devices going forward. This move will bring a more reliable experience, an improved deployment experience for admins, and it will serve as the platform for future innovation and richer management scenarios for Microsoft Teams Android devices.
AOSP Device Management is the replacement for the legacy Android Device Administrator solution used for managing Teams Devices.
This mandatory migration will take place over several months and will not start until Q3CY24. We’ve taken great care to minimize the end user and IT admin impact with this migration, but there is action required for you as the IT admin. Following our published guidance for migration will only take a few minutes and will ensure your devices are seamlessly migrated between MDM platforms with a simple firmware upgrade. End users will notice no difference in device functionality.
There are two parts to a successful migration to AOSP Device Management:
Step 1: Create new enrollment profiles & configuration/compliance policies in Intune. This step can be completed starting in Q3 CY24 and can be completed even before the firmware updates are available. Performing these steps will have no impact on existing devices but please note that failing to create enrollment profiles before performing step 2 will result in signed out Teams Devices.
Step 2: Take firmware updates containing the new AOSP agent and Authenticator app, for each of the supported Teams Devices. This firmware update will automatically unenroll the device from Device Administrator and re-enroll the device with AOSP device management with your newly created enrollment profile. This entire process will be done while the device remains signed into Teams. These firmware updates will be made available from Teams Admin Center as a manual update to allow you time to slowly migrate your devices. Availability is expected later in Q3 CY24.
Step by step guidance on how to complete steps 1 and 2 can be found in the AOSP migration admin guide.
FAQ:
My organization does not enroll our Teams Android Devices in Intune today, do we need to do anything?
No, if your organization does not enroll its Teams Devices into Intune today and currently has the Intune license unassigned from accounts signing into Teams Devices, there will be no impact when you install the new device firmware which supports AOSP device management. Your devices will get the new management applications, but no action is required beyond updating the devices to the new firmware once released.
What happens if I don’t do anything?
Devices will receive the firmware update through Teams Admin Center eventually regardless of admin action through automatic updates.
If your organization does enroll its Teams devices into Intune, then by not creating an enrollment profile, devices will fail to enroll properly in Intune and will thus not be able to sign in (or sign out if they were already signed in before). Not creating new AOSP policies could lead to unexpected issues in your environment, as Device Administrator policies will not be migrated automatically.
This blog post mentions that I need to wait until Q3CY24 to create enrollment profiles, I already see the option in my Intune admin portal, why should I wait?
The current enrollment profile creation has a 90-day expiration date. If you create the profile now, you will need to extend it every 90 days, we are working to improve this experience with a much longer expiration period prior to Q3CY24.
Wait, I don’t have to enroll my devices in Intune at all? Why would I want to use Intune?
Intune provides a security wrapper around your devices allowing you to set security controls as well as detect if the device is compliant with your organization security requirements prior to allowing the device to sign in to your M365 instance.
Are there devices that will not migrate to AOSP Device Management?
All devices currently certified and supported for Microsoft Teams will be migrated, those devices can be found here:
Teams Rooms on Android
Teams Phones, Panels, & Displays
There are some Teams Android Devices that were previously supported, but are now end of life, which you may still have in your environment, those devices specifically not migrating are listed here:
AudioCodes C448HD (Teams Phone)
AudioCodes C450HD (Teams Phone)
AudioCodes RXV80 (Teams Rooms on Android)
Yealink VP59 (Teams Phone)
Yealink MP52 (Teams Phone)
Yealink VC210 (Teams Rooms on Android)
Crestron UC-2 (Teams Phone)
Crestron UC-P8 (Teams Phone)
Crestron UC-P8-I (Teams Phone)
Crestron UC-P10 (Teams Phone)
Crestron UC-P10-I (Teams Phone)
Crestron UC-P8-C (Teams Phone)
Crestron UC-P8-C-I (Teams Phone)
Crestron UC-P10-C (Teams Phone)
Crestron UC-P10-C-I (Teams Phone)
Crestron UC-P8-TD (Teams Display)
Crestron UC-P8-TD-I (Teams Display)
Crestron UC-P10-TD (Teams Display)
Crestron UC-P10-TD-I (Teams Display)
EPOS Expand Vision 3T (Teams Rooms on Android)
What happens with those devices that will not migrate?
The devices listed above will remain on Android Device Administrator. These devices can still be used once Android Device Administrator is fully deprecated but will be considered legacy and unsupported where features may be removed at any time. To use the device you will need to unenroll from Intune and then sign the device back in without an Intune license assigned to the account, more information about this can be found here: Manage Intune devices with Android device administrator | Microsoft Learn
Will I notice anything different with the devices after the migration?
No, the devices will not look any different from an end user perspective. As an IT admin you will see two new applications installed on your devices (visible in the software health tab in Teams Admin Center), these two applications are the “Authenticator” app and the “Microsoft Intune” app these applications replace the previous “Company Portal” application.
Why not use Android Enterprise?
Android Enterprise specifically requires Google Mobile Services, and since Teams Devices do not contain Google Mobile Services, AOSP Device Management is our solution.
What if once this migration is complete, I take a device out of storage that has not been through the migration? Will I be able to upgrade it?
Yes, there will be out of box updates available to ensure devices are able to receive the latest apps.
I’m a GCC-High customer and I don’t see the option for Teams Devices in the AOSP Device Management enrollment profile?
This is expected, this feature will be released to GCC-High customers at the end of June.
Who do I contact if I need more support or information?
Please reach out to your Microsoft account representatives or open a support case for more details.
Microsoft Tech Community – Latest Blogs –Read More
Stream features I don’t understand
I’m just starting to use Stream this month. There are some things I don’t understand.
What use is the Recommended bar on the home screen? I don’t need recommendations. I just need a searchable list of my Streams.Why don’t my most recent Streams show up on the home screen? I’ve made a dozen new Steams over the last few days, but they don’t show up under All or Created by me, etc.Why, when I try to add a Stream to my favorites, does it come back with “Something went wrong…”Why is Microsoft spending a zillion dollars on AI to help me plan a dinner party, when I just want to get my work done?
I’m just starting to use Stream this month. There are some things I don’t understand.What use is the Recommended bar on the home screen? I don’t need recommendations. I just need a searchable list of my Streams.Why don’t my most recent Streams show up on the home screen? I’ve made a dozen new Steams over the last few days, but they don’t show up under All or Created by me, etc.Why, when I try to add a Stream to my favorites, does it come back with “Something went wrong…”Why is Microsoft spending a zillion dollars on AI to help me plan a dinner party, when I just want to get my work done? Read More
Category Color Coding not viewable by Delegate on New Mode
Ran into an issue when helping a user today of not being able to see the color coding of a shared calendar. User is a delegate for someone that has their calendar items color coded. I’ve toggled permissions and we’ve removed/re-added the shared calendar in question. This happens in New Mode. When reverting to Legacy Mode, the colors are viewable on the shared calendar.
I’ve tried most things except for a complete reinstall of Outlook. Any thoughts?
JB
Ran into an issue when helping a user today of not being able to see the color coding of a shared calendar. User is a delegate for someone that has their calendar items color coded. I’ve toggled permissions and we’ve removed/re-added the shared calendar in question. This happens in New Mode. When reverting to Legacy Mode, the colors are viewable on the shared calendar.I’ve tried most things except for a complete reinstall of Outlook. Any thoughts?JB Read More