Friday, December 4, 2020
Add arrays to a structure
Num2cell is a useful function. The important part is that it could convert an array (m x n) to scalar array (y x 1) so you could add this to a structure.
aa=table2struct(readtable((fullfile(filePath0,'curve','params',file0(1).name))));
%This is the structure you want to add new values to
file1=dir(fullfile(filePath0,'ROI_dark*.mat'));
dark_files=load(fullfile(filePath0,file1(1).name),'Intensity','dff0');
%Then you got two variables, both are two dimensional array. To add them, you have to first convert them into cell:
cc=num2cell(dark_files.Intensity,1);
%Then add them:
[aa.dark_Intensity]=cc{:};
Subscribe to:
Posts (Atom)