Reshape 1x2 struct to 1x1 stuct where dimension doesn't match.

I have a 1x2 stuct with 27 fields.
E.g. I can't plot A cause the dimensions of A(1,1) and A(1,2) don't match. All the values are doubles. And I would like to make it a 1x1 struct so I can work with it. I combined 2 single structs to get this 1x2 struct if this helps.
Any tipps, help??

댓글 수: 2

They don't match. What do you want to do about it? Concatenate?
lets say in A(1,1) there are doubles from 1 to 672618 and in A(1,2) from 672619 to 929139. How can I make 1 field from 1 to 929139 instead?

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

 채택된 답변

José-Luis
José-Luis 2017년 1월 3일
your_field = [A(1,1); A(1,2)];

댓글 수: 8

I tried this already. Nothing changes. Instead of 1x2 its now a 2x1 struct :(
First test seems promising. Now I just need to loop it and put it back into a struct. Thank you.
Please accept the answer that best solves your problem.
I wanted to test some more. Is there anyway I can use fieldnames() as variabels in a loop?
That's a different question. Here goes:
bla = struct('a',1,'b',2:5,'c',3)
fields = fieldnames(bla)
for i=1:numel(fields)
bla.(fields{i})
end
stephen I know thats bad. But I am in the stage of ordering my Data before working with it. and I don't know any other solution to sort it.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

질문:

2017년 1월 3일

댓글:

2017년 1월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by