struct array

조회 수: 6 (최근 30일)
zhang
zhang 2011년 9월 22일
Hi guys,
There are two struct arrays, A, B; They both have a member data called "id". For example: A(1).id = []; A(2).id = [] B(1).id = 'hello'; B(2).id = 'yes';
I'd like to copy the "id" of B to A without using loop.
Is there any method?
Thanks
  댓글 수: 1
Fangjun Jiang
Fangjun Jiang 2011년 9월 22일
help deal, among a few other solutions.

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

채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 9월 22일
[A(:).id] = B.id
  댓글 수: 6
Andrei Bobrov
Andrei Bobrov 2011년 9월 22일
Sorry, this is my english. I mean, you must answer the question and the author takes his
Fangjun Jiang
Fangjun Jiang 2011년 9월 22일
Both you and Daniel provided the same good solution. I just want to point it out that (:) can be omitted. The OP didn't seem to accept many of the obviously correct answers.

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

추가 답변 (1개)

Daniel Shub
Daniel Shub 2011년 9월 22일
Does this work?
[A(:).id] = B(:).id

카테고리

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