Skip to content
Snippets Groups Projects
Commit 0b265049 authored by preischig's avatar preischig
Browse files

gtIndexAllGrainValues: modified help.

parent 72a86991
No related branches found
No related tags found
No related merge requests found
function val = gtIndexAllGrainValues(grain, field1, field2, ind1, ind2, cell2mat)
% val = gtIndexAllGrainValues(grain, field1, field2, ind1, ind2, cell2mat)
function val = gtIndexAllGrainValues(grain, field1, field2, ind1, ind2, matform)
% val = gtIndexAllGrainValues(grain, field1, field2, ind1, ind2, matform)
% ------------------------------------------------------------------------
% Returns a column vector containing the values with indices (ind1,ind2) in
% grain.field1.field2 from all the grains in 'grain'.
%
% INPUT
% grain - all grain data (cell vector)
% field1 - field 1 name (string)
% field2 - field 2 name (string) or empty if not applicable
% ind1 - row index 1 of variable (1x1)
% ind2 - column index 2 of variable or empty if not applicable (1xn)
% grain - all grain data (cell vector)
% field1 - field 1 name (string)
% field2 - field 2 name (string) or empty if not applicable
% ind1 - row index 1 of variable (1x1)
% ind2 - column index 2 of variable or empty if not applicable (1xn)
% matform - output in matrix form (does not work in all cases)
%
% OUTPUT
% val - cell column array; size(m,n) where m is the number of grains; each
% element has the format as the original grain data, if ind1 and ind2 are
% empties
% val - cell column array; size(m,n) where m is the number of grains; each
% element has the format as the original grain data, if ind1 and ind2 are
% empties
%
% EXAMPLE
% gtIndexAllGrainValues(grain, 'nof_pairs', [], 1, [])
......@@ -38,8 +39,8 @@ if ~exist('ind2','var')
ind2 = [];
end
if ~exist('cell2mat','var') || isempty(cell2mat)
cell2mat = true;
if ~exist('matform','var') || isempty(matform)
matform = true;
end
......@@ -133,7 +134,9 @@ else
end
if cell2mat
if matform
% !!! This does not work for fields with e.g: size 3xn, where n is
% different for each val{ii}:
val = reshape([val{:}],size(val{1},2),[])';
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment