0001 function xp = dsImg2mdd(data_img,merge_covaried_axes,merge_sparse_axes,varargin)
0002
0003 if nargin < 2
0004 merge_covaried_axes = true;
0005 end
0006
0007 if nargin < 3
0008 merge_sparse_axes = true;
0009 end
0010
0011
0012 if merge_covaried_axes && isfield(data_img(1),'varied')
0013
0014
0015
0016
0017
0018
0019
0020 [Abasis,Abasisi, Asubs] = dsGetLinearIndependentDs(data_img);
0021
0022 gt1 = cellfun(@(x) length(x) > 1, Asubs);
0023 Asubs = Asubs(gt1);
0024
0025
0026
0027
0028 vary_labels = data_img(1).varied;
0029 Nlinked = length(Asubs);
0030 variedname_merged = cell(1,Nlinked);
0031 varied_vals = cell(1,Nlinked);
0032 for j = 1:Nlinked
0033 [data_img, variedname_merged{j}, varied_vals{j} ] = dsMergeVarieds(data_img,vary_labels(Asubs{j}));
0034 end
0035
0036
0037
0038
0039 end
0040
0041 if merge_sparse_axes && isfield(data_img(1),'varied')
0042 [data_img, variedname_merged, varied_vals ] = dsAutoMergeVarieds(data_img);
0043 end
0044
0045
0046
0047
0048 [data_table,column_titles] = dsDataField2Table (data_img,'plot_files');
0049
0050
0051
0052
0053
0054
0055
0056
0057 xp = MDD;
0058 X = data_table{1}; axislabels = data_table(2:end);
0059 xp = xp.importDataTable(X, axislabels);
0060 xp = xp.importAxisNames(column_titles(2:end));
0061
0062
0063
0064
0065
0066 xp = xp.squeezeRegexp('Dim');
0067
0068
0069
0070 meta = struct;
0071 meta.datainfo(1:2) = MDDAxis;
0072 meta.datainfo(1).name = 'time(ms)';
0073 meta.datainfo(1).values = 1:10;
0074 meta.datainfo(2).name = 'cells';
0075 cell_names = [1:5];
0076 cell_names_str = cellfunu(@(s) ['Cell ' num2str(s)], num2cell(cell_names));
0077 if isfield(data_img(1),'varied')
0078 meta.dynasim.varied = data_img(1).varied;
0079 else
0080
0081 meta.dynasim.varied = {'Varied1'};
0082 end
0083 xp.meta = meta;
0084
0085
0086
0087 end