Converting Table into a Gridded Array for Use with 'griddedInterpolant'

13 visualizaciones (últimos 30 días)
Jonathan Krenzel
Jonathan Krenzel el 18 de Mayo de 2021
Movida: Dyuman Joshi el 22 de Mzo. de 2024 a las 8:30
I am needing some help coming up with a solution to a problem. I have a large dataset that is being read into Matlab using 'readtable' and stored as variable 'C'. The dataset is generated externally and has the following format:
where C is a function of the other variables ( C = f(a1, a2, a3, ..., an) ). All of the 'a' variables are doubles. The number of 'a' variables, n, however is dependent upon the dataset being processed but will always be greater than or equal to 2 (n >= 2).
How would I go about converting this table into an array that works with 'griddedInterpolant'? The complete dataset provides all of the information needed to create a gridded data set. The downstream process currently relies on 'griddedInterpolant', however changes could be made if it would improve the overall performance. For reference, the downstream process takes the dataset, refines it, and then uses that refined data to generate the final results.
I have tried using 'unique' on each of the 'a' variables to obtain the inputs required for 'ndgrid', however when I attempt to 'reshape' the 'C' array I end up corrupting the data.
Thanks for any help that you can provide.
  1 comentario
Abdullah
Abdullah el 22 de Mzo. de 2024 a las 8:21
Movida: Dyuman Joshi el 22 de Mzo. de 2024 a las 8:30
Hello Jonathan
did you find the answer of your question? i am searching for the same problem

Iniciar sesión para comentar.

Respuestas (1)

Aghamarsh Varanasi
Aghamarsh Varanasi el 25 de Mayo de 2021
Hi,
You can access the data in a table in the form of a matrix using the syntax, T.Variables. For example,
ctable = readtable(); % let ctable be the variable in which the table is stored
ctableMatrix = ctable.Variables; % gives the table data as a matrix
For more information please refer to this documentation page.
Hope this helps

Categorías

Más información sobre Tables en Help Center y File Exchange.

Productos


Versión

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by