How can I create many tables of the main one and store them?

alberto
my_table = readtable('some.csv')

'L1'    'B'
'L2'    'B'
'L3'    'A'
'L4'    'C'
'L5'    'B'
'L6'    'C'
'L7'    'C'
'L8'    'A'

In the second column there are different values, B, A, and C. I want to create smaller tables from this one, depending on the value in the right, so the expected outcome would be:

'L1'    'B'
'L2'    'B'
'L5'    'B'

and

'L3'    'A'
'L8'    'A'

and

'L4'    'C'
'L6'    'C'
'L7'    'C'

each of them stored in a different variable for later use.

Anthony

You can access table contents with my_table.Variables or my_table.my_column_header. From there, you can compare the values with A, B and C; then create new tables.

% Get the ABC column.
content=my_table.Variables;
ABC = char(content{:,2});

% Alternatively, if you have the header.
ABC = char(my_table.Line2);

% Create new tables.
tableA = table(my_table(ABC == 'A',:));
tableB = table(my_table(ABC == 'B',:));
tableC = table(my_table(ABC == 'C',:));

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I create a one to many relationship that allows me to query two tables?

How do I map one to many relationship on a JSP page and store them while submitting the page?

How can I create points, display them and store them in some sort of Array

How can I check how many itens I have in an array and assign each one of them to a label in Swift?

How to create a one to many relationship based on one to one (three tables)?

How can I put items of different sizes in one page avoiding too many gaps between them?

How can I create histograms from nested dataframes and store them as objects in a list in r?

If I know how many of a collection to create, should I create them all or create them on the fly by add()

How can I drop many BigQuery tables without having to delete each one individually?

How can I fetch data from 2 tables using HQL having one to many association with each other?

How can I join two tables with a many-to-one relationship ordered by date?

How many Max number of tables I can create in a given Cassandra cluster ? Is there a limit?

How can I store one to many in PostgreSQL via array of alt keys?

How do I compare two MySQL tables and then update one of them

How can I create a button with Tkinter that uses two commands, which one of them updates a label?

How can I create a dataset with 3 new columns (each one from a different dataset) and rename them?

How create database and tables, and fill them with data? I got error

How can i write many "OR" in one "IF" javascript

How can I create external tables with Hive?

How many telegram bots can I create?

How I can Create many answer

how can i create rows in 2 models(tables) with reusable functions based on one form

How many access policies can I create and add on the same one Azure container?

In javascript, how can I create element which has many attributes with createElement() in one line?

How can I create nested store pipes?

How can i store images in an array and with a for loop print them? PHP

How can I store strings with variables in them in another Java class?

How to store the identifications for goroutines so that I can stop them later

How can I store files in an archive without compressing them?