How to Merge two structures.
古いコメントを表示
I'm trying to merge two structures together and can't figure out how to do it. I have one with data [x, x, 0, 0, x, x] and one with data [0, 0, y, y, 0 0] and I would like [x, x, y, y, x, x]. I have tried using union and that just joins the two front to back, I was told to try using "&" but that also didn't work. Any ideas would be great. I don't mind using the help feature in matlab, just not sure what to search for or what functions to use.
Thank you,
Nick
採用された回答
その他の回答 (2 件)
Sean de Wolski
2013 年 5 月 23 日
So:
x.data = [1 1 0 0 1];
y.data = [pi pi pi pi pi];
z.data = x.data;
idx = ~z.data;
z.data(idx) = y.data(idx);
カテゴリ
ヘルプ センター および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!