Combine two structure variables with different fields

バージョン 1.0.0 (1.14 KB) 作成者: Taesam Lee
Combine two structure variables with different fields x.a, x.b y.c,y.d z=combinefield(x,y) z.a,z.b,z.c,z.d
ダウンロード: 17
更新 2019/4/15

ライセンスの表示

function [Out]=combineField(A,B)
% Combine two structure variables into one
% A and B are stuructures want to include both
% Out: Output.

fnames=fieldnames(B);
for is=1:length(fnames)
Data=getfield(B,fnames{is});
A=setfield(A,fnames{is},Data);
end
Out=A;

引用

Taesam Lee (2024). Combine two structure variables with different fields (https://www.mathworks.com/matlabcentral/fileexchange/71213-combine-two-structure-variables-with-different-fields), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2019a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
タグ タグを追加

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0