converting cell to struct with fields

조회 수: 2 (최근 30일)
WILLBES BANDA
WILLBES BANDA 2020년 5월 27일
댓글: Ameer Hamza 2020년 5월 27일
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.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 27일
Something like this
S.DeliArg = [DeliArg{:}];
S.AlgTry = [AlgTry{:}];
  댓글 수: 2
WILLBES BANDA
WILLBES BANDA 2020년 5월 27일
thank you honourable, it works!!!
Ameer Hamza
Ameer Hamza 2020년 5월 27일
I am glad to be of help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by