Issues with splitting a matrix into many smaller matrix
Show older comments
I am trying to group my origional matrix (size 11250 x 2) into many smaller matricies, grouped by the value in the first column.
I then want to take the mean and standard deviation of these values to report on the data that I have recieved.
PIN
PIN_SORT = sort(PIN.', 2).'
n = 1
for i = -4.5200:0.04: 0.7200
M{n} = PIN_SORT(find(PIN_SORT(:,1)== i),:);
%disp(M{'i'})
%disp(i)
n = n+1
end
avg{n} = mean(M{n})
stddev{n} = std(M{n})
The code does what I want it to do, for certain values, and will leave an empty spot in the array for the rest.
The two comments were attepmts at trouble shooting, but alas to no success.
Is there a glaringly obvious flaw in my approach or in my code, or is there an oversight on my behalf.
1 Comment
Stephen23
on 11 Aug 2023
"Is there a glaringly obvious flaw in my approach or in my code, or is there an oversight on my behalf."
This is worth reading as well:
Accepted Answer
More Answers (1)
You need to load the data from csv file into MATLAB first.
T = readtable('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1455237/PIN.CSV');
PIN = T.(4) % pick your column from table T
1 Comment
Lachlan Stephens
on 11 Aug 2023
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!