Clear Filters
Clear Filters

I have 3 double array of sizes 6x1 double, 4x1 double and 5x1 double. I like to combine them to make a structure of size 1x3 struct containing all these 3 double arrays.

6 views (last 30 days)
I have 3 double array of sizes 6x1 double, 4x1 double and 5x1 double. I like to combine them to make a structure of size 1x3 struct containing all these 3 double arrays.
If we click on 1x3 struct, inside it should look like this:
Fields times
1 6x1 double
2 4x1 double
3 5x1 double
How can I do it? Could you kindly help? Thank you.

Accepted Answer

Stephen23
Stephen23 on 11 Jan 2023
A = rand(6,1);
B = rand(4,1);
C = rand(5,1);
S = struct('times',{A,B,C})
S = 1×3 struct array with fields:
times

More Answers (0)

Categories

Find more on Structures 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!