2022 How to Load, Clean, and Visualize Raw CSV Data in MATLAB | MATLAB Tutorial

preview_player
Показать описание
How to Import, Clean, and Visualize Raw .csv Data in MATLAB! Load the data, filter and clean arrays, and create plots and graphs of the raw data. Awesome beginner project!

1. Import or Load Raw Data into MATLAB
2. Convert Raw Data to Proper Datatypes
3. Perform String Manipulation on Strain Data
4. Create Visualizations, Optimize Visuals

LEARN MATLAB

CHAPTERS
0:00 Import / Load Data
2:33 Convert Tables to Arrays
5:28 String Manipulation
8:40 Cleaned Data!
9:30 Data Visualizations
9:55 3D Plot plot3()
10:43 Scatter Plot scatter()
15:09 Final Result

MATLAB BASICS

ADVANCED MATLAB

---------------------------------FREE CODE FROM VIDEO----------------------------------------------------------
% Plotting Sensor Data

% Read in Sensor Data
clc, clearvars, close all, format compact

% Load in Data

%% Data Filtering/Processing (MUST BE RUN AFTER SECTION 1)
clc, clearvars -except data, format compact, close all

% Convert x, y, and strain from Table to Array
strain(:,1) = table2array(data(:,1));
strain(:,2) = table2array(data(:,2));
s3 = table2array(data(:,3));

% Third Column is tricky
% cell to string... or char?
s3 = string(s3);

% Get rid of values right of !
s3 = split(s3,"!");
% Convert to double (numeric)
s3 = double(s3(:,1))

strain(:,3) = s3

% Data Visualizations
% We have x, y, and 'z' ...plot3() or surf()?

% 3D Plot!
figure(1)
plot3(strain(:,1), strain(:,2), strain(:,3), ...
'.b', 'Markersize', 20)

title('Strain (MPa) over Sensor Grid')
xlabel('x dist (m)'), ylabel('y dist (m)')
zlabel('strain (MPa)'), grid on

% Scatter Plot w/ Color
figure(2)
scatter(strain(:,1), strain(:,2), ...
strain(:,3)*5, ... % size
strain(:,3), ... % color
'filled')

xlabel('x dist (m)'), ylabel('y dist (m)')
title('Strain (MPa) over Sensor Grid')
cc = colorbar(); title(cc,'MPa')
xlim([0 11]), ylim([0 11]), grid on
------------------------------------------------------------------------------------------------------------------------------------

HELP A BROTHER OUT
Thank you so much for watching! Please consider subscribing as a thank you if you benefited from this content! :D

HELPING MY BROTHERS AND SISTERS OUT
Comment below and I will happily answer all your questions, queries, and conundrums... whether or not they pertain to programming ;)

Рекомендации по теме
Комментарии
Автор

This was exactly what I needed for a lab I was assigned. Thank you!

Kolarias
Автор

This is so helpful, Thank you very much.

onyiboemmanuel
Автор

WOW! The final plot was so much more clear and so pretty. Great explanation for cleaning raw data and how to best represent the data you have. Keep up the great work!

alexarunyan
Автор

Wow! Nice explanation. I have a question for you if CSV file data specifies as timestamp in one column and temperature in another column, how to separate timestamp to date and time

divyajyothi
visit shbcf.ru