How do I use a loop to go through a large dataset and put each column into a array?
Show older comments
I'm doing a project that needs to process large datasets. My data is taken from a table with headings and I need each column to be made into a separate array to then plot graphs from.
Say my dataset is 1300 x 85 table
It's too time consuming to write out the code for each column separately using my current method:
table=readtable('myfile.csv"); % import file as a table
C1=table{:,1}: % make a singular column into array
histogram(C1) % plot graph using array
Instead, can I use a loop to take table of length, x and step through each column itself and define them as separate variables?
Would an if or for loop be more suitable?
1 Comment
Star Strider
on 30 Jan 2023
‘Instead, can I use a loop to take table of length, x and step through each column itself and define them as separate variables?’
Please do not ever do that!
‘Would an if or for loop be more suitable?’
Yes with for!
.
Accepted Answer
More Answers (0)
Categories
Find more on Tables 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!