Question
In matlab: Please help me add more onto this code where I can save the data on to an export text file. The data can
In matlab:
Please help me add more onto this code where I can save the data on to an export text file. The data can currently be seen within the command window and it has multiple columns. Thanks.
function[TopX, TopY, BottomX, BottomY] = AssortingDatFile(finalM) % Should analyze the top and bottom arrays of the X & Y coordinates
TopX = [];
TopY = [];
BottomX = [];
BottomY = [];
minX = min(finalM(:,1)); % Find the minimum and maximum values of X & Y
maxX = max(finalM(:,1));
minY = min(finalM(:,2));
maxY = max(finalM(:,2));
for i = 1:length(finalM) % Goes through finalM made from initial function
finalM(i,1) = (finalM(i,1) - minX) / (maxX - minX); % Normalizing X & Y coordinates
finalM(i,2) = (finalM(i,2) - minY) / (maxY - minY);
if finalM (i,2) > 0 % Checks to see if negative
TopX = [TopX, finalM(i,1)]; % Top Array
TopY = [TopY, finalM(i,2)];
else
BottomX = [BottomX, finalM(i,1)]; % Bottom Array
BottomY = [BottomY, finalM(i,2)];
end
end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started