Please How do I extract data from a struct

7 views (last 30 days)
Please Im trying to merg data from a variable (struct) to another table. How do I archieve this?
Star Strider
Star Strider on 6 May 2022
The struct2table function will convert the structure to a table.
Integrating it with another table depends on what the variables are and the existing table. Merging them could be anything from straightforward to impossible.

Sign in to comment.

Answers (1)

Bhavana Ravirala
Bhavana Ravirala on 9 May 2022
Hi osemudiamen oriabure,
I understand that you are trying to convert a struct variable to a table and then merge it with another table. You may convert a struct into a table with the help of the "struct2table" function and join with another table with the help of "join" function.
s.person=[ 'a' ,'b', 'c'];
s.height=[ 5.3, 5.11, 6.1];
t= struct2table(s); % converting struct to table
T= join(T,t); % T is already existing table
For more information refer below documentations:
Hope this helps!!


Find more on Data Type Conversion 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!

Translated by