Questions tagged [matlab-table]

Fro questions about MATLAB's table data class.

Mathworks tables documentation

136 questions
2
votes
1 answer

Splitting up a matlab table in vectors

i'm fairly new to matlab and i'm looking for a way to evaluate data in a table. There's an excel table as illustration attached. My measurements are savedin a txt-file divided by cycle numbers. All data is in one table though. Eventually i want to…
Alexander K
  • 137
  • 1
  • 1
  • 8
2
votes
1 answer

Iterate through a CSV and assign data into new tables, based on unique IDs

I'm attempting to iterate through a CSV file and assign the data within each row into new tables, based on unique IDs. The unique IDs are found within the 'Unit' column - please find the formatting of the CSV file…
Adam Johns
  • 79
  • 5
2
votes
2 answers

Rearrange MATLAB table variables (Release 2016)

I have a table in MATLAB with variable titles equal to: titles = {'TZ_1', 'TZ_2', 'TZ_3', 'DATE'}; Is there any way to move change the data to have the DATE before TZ_1? titles = {'DATE', 'TZ_1', 'TZ_2', 'TZ_3'}; I can see movevars in the 2022…
mhooper
  • 89
  • 6
2
votes
2 answers

Creating mesh from 3-column table in matlab

I have a table with values extracted from a csv I want to make a contour plot from. Let's use this table as an example tdata.x = [1;2;1;2]; tdata.y = [3;3;4;4]; tdata.z = randn(4,1); tdata=struct2table(tdata); >> tdata tdata = 4×3 table x y…
Morten Nissov
  • 392
  • 3
  • 13
2
votes
1 answer

Create table with mixed data types from arrays

I would like to compose several arrays into one table. Since they have different data types, it seems not very straightforward. Consider this simple MWE: daysTotal = 2; hoursTotal = daysTotal*24; timeStepHours = 1/4; nhi =…
winkmal
  • 622
  • 1
  • 6
  • 16
2
votes
3 answers

Return the maximum value of every subgroup in a table

I have a section of table like this: X Y Value __ __ __ 1 2 6.9 1 3 6.8 1 4 8.1 2 1 7.2 2 3 11.7 2 4 16 3 1 22.6 3 2 20.5 3 3 18.1 … … … For each group of rows…
jane
  • 567
  • 2
  • 12
2
votes
2 answers

Matlab `rowfun` function with multiple outputs: Safe to assume row order?

I tried providing a function to rowfun that returns multiple-row output, of the same height as the input. It seems to work as expected. % Example table with 2-column-array as a single data field x = table( [1;1;2;2] , [[2;2;1;1] [2;1;2;1]] , ... …
user36800
  • 2,019
  • 2
  • 19
  • 34
2
votes
1 answer

Writing a table to csv file in Matlab

I have a table. A sample of a cell is as below: var = [1 16 18 17; 1 10 15 6; 78 10 26 43; 9 13 91 4; 1 17 81 23]; I also want to add the column id to this like below: id=[1;1;1;1;1]; Now i want to create a table by concatenating id column with…
pmdav
  • 301
  • 4
  • 14
2
votes
1 answer

Write a table object into csv in matlab

I have a table object in Matlab with cells as shown in the snapshot: The cells inside Land and Seamark are as below: The class of the objects are as below: >> class(FileData.gTruth.LabelData.Land) ans = 'cell' >>…
pmdav
  • 301
  • 4
  • 14
2
votes
2 answers

How to create table array in MATLAB?

I would like to store multiple tables in one array. In my code below, I am creating two tables T1 and T2. I want to store these tables into one variable MyArray. LastName = {'Sanchez';'Johnson';'Li';'Diaz';'Brown'}; Age = [38;43;38;40;49]; Smoker =…
oro777
  • 1,110
  • 1
  • 14
  • 29
2
votes
1 answer

How can I create a table to hold data from an iteration in MATLAB?

Let us suppose that we have two matrices as input, X and Y. I would like to regress each column of Y on each column of X and calculate several parameters, then create a table for the results. Here is my starting code: function…
user466534
2
votes
2 answers

Can table variable names start with a number character?

I am running something like this: table = readtable(path,'ReadVariableNames',true); In the .csv file all of the cells of the first row contain string identifiers like '99BM', '105CL', etc. Everything starts with a number. The command above gives a…
Dino C
  • 307
  • 3
  • 15
2
votes
2 answers

writetable replace NaN with blanks in Matlab

Given a Matlab table that contains many NaN, how can I write this table as an excel or csv files where the NaN are replaced by blanks? I use the following function: T = table(NaN(5,2),'VariableNames',{'A','C'}) writetable(T, filename) I do not…
WJA
  • 6,676
  • 16
  • 85
  • 152
2
votes
4 answers

writetable without dimension names

I'm trying to write a CSV from a table using writetable with writetable(..., 'WriteRowNames', true), but when I do so, Matlab defaults to putting Row in the (1,1) cell of the CSV. I know I can change Row to another string by setting…
David Kelley
  • 1,418
  • 3
  • 21
  • 35
2
votes
1 answer

Matlab object array to table (or struct array)

Testing matlab2015a. I was using a struct array that at some point I converted to a table with struct2table. This gave a nice table with columns named as the fields of the struct. Some time later and by unrelated reasons, these structs are now…
Álex
  • 1,587
  • 11
  • 17
1
2
3
9 10