CSV huge data and mesh grid.
Show older comments
Hi all,
I am quite old to Matlab, but have not used it for so many years (since 2007...) so a lot of rust out there.
I am getting some accelerometer data in a CSV file in the following format:
Time X Y Z Vector
( I combine the X,Y and Z components to find the final vector. )
There are 46 CSV files to read and each one of them creates a unique 2D line using the Time and Vector columns from each CSV file.
Here is the issue...
I want to create a 3D surface, basically by combining these 46 lines. The first 2-3 files do not have the same collumn length, but I can replace that with zeros if need be, or maybe discart them altogether and keep the ones that have the same length.
I have a 360000 x 5 double and I am using the 1st and 5th column. Meshgrid will not do the trick as it's a huge chunk of data.
So far all the data that I have seen to answers do not lead anywhere...
Your help is much appreciated,
I attach one of the files to see an example and here is the code that I have for the time being:
clc;
clear;
format loose;
file='DATA-003.csv';
data=readmatrix(file); %read file
A=data;
A(:,2)=A(:,2)./168.3; %x
A(:,3)=A(:,3)./168.3; %y
A(:,4)=A(:,4)./168.3; %z
for i=1:length(A) %find the vector
A(i,5)=sqrt(A(i,2)^2+A(i,3)^2+A(i,4)^2);
end
x=A(:,1);
y=A(:,5);
figure(1)
% Trick surface into a 2-D plot
surface('XData', [x x], ...
'YData', [y y], ...
'ZData', zeros(numel(x),2), ...
'CData', [y y], ...
'FaceColor', 'none', ...
'EdgeColor', 'interp', ...
'Marker', 'none');
xlim([0 max(x)]);
Kindest regards,
Dimitri
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





