MATLAB Answers

converting cell to struct with fields

1 view (last 30 days)
WILLBES BANDA
WILLBES BANDA on 27 May 2020
Commented: Ameer Hamza on 27 May 2020
Hi, i have 2 cell arrays that i want to convert to structure with fields. The first cell is A (10×1 cell array)
DeliArg= {[-30]}
{[-25]}
{[-20]}
{[-15]}
{[-10]}
{[ -5]}
{[ 0]}
{[ 5]}
{[ 10]}
{[ 15]}
the second cell is
AlgTry = Columns 1 through 12
{[-10]} {[-5]} {[0]} {[5]} {[10]} {[13]} {[15]} {[20]} {[25]} {[30]} {[35]} {[40]}
Columns 13 through 14
{[45]} {[50]}
Now i want to represent the data in the format below as struct with fields
DeliArg : [-25 -20 -15 -10 -5 0 5 10 15]
AlgTry: [-10 -5 0 5 10 13 15 20 25 30 35 40 45 50]
Please help.

  0 Comments

Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 27 May 2020
Something like this
S.DeliArg = [DeliArg{:}];
S.AlgTry = [AlgTry{:}];

  2 Comments

WILLBES BANDA
WILLBES BANDA on 27 May 2020
thank you honourable, it works!!!

Sign in to comment.

More Answers (0)

Products