Changeset 6615


Ignore:
Timestamp:
11/17/10 15:59:14 (14 years ago)
Author:
jschierm
Message:

preqmu.m: Fixed capability to have multiple variables/responses in a field. Also fixed capability for multiple variable/response sets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk/src/m/qmu/preqmu.m

    r6568 r6615  
    4343
    4444%expand variables and responses
    45 variables=expandvariables(md,md.variables);
    46 responses=expandresponses(md,md.responses);
     45variables=expandvariables(md,variables);
     46responses=expandresponses(md,responses);
    4747
    4848%go through variables and responses, and check they don't have more than md.npart values. Also determine numvariables and numresponses{{{1
     
    5252        field_name=variable_fieldnames{i};
    5353        fieldvariables=variables.(field_name);
    54         if numel(fieldvariables)>md.npart,
    55                 error('preqmu error message: one of the expanded variables has more values than the number of partitions (setup in md.npart)');
     54        for j=1:numel(fieldvariables)
     55                if strncmpi(fieldvariables(j).descriptor,'scaled_',7) && str2int(fieldvariables(j).descriptor,'last')>md.npart,
     56                        error('preqmu error message: one of the expanded variables has more values than the number of partitions (setup in md.npart)');
     57                end
    5658        end
    5759        numvariables=numvariables+numel(variables.(field_name));
     
    6365        field_name=response_fieldnames{i};
    6466        fieldresponses=responses.(field_name);
    65         if numel(fieldresponses)>md.npart,
    66                 error('preqmu error message: one of the expanded responses has more values than the number of partitions (setup in md.npart)');
     67        for j=1:numel(fieldresponses)
     68                if strncmpi(fieldresponses(j).descriptor,'scaled_',7) && str2int(fieldresponses(j).descriptor,'last')>md.npart,
     69                        error('preqmu error message: one of the expanded responses has more values than the number of partitions (setup in md.npart)');
     70                end
    6771        end
    6872        numresponses=numresponses+numel(responses.(field_name));
     
    7680%build a list of variables and responses descriptors. the list is not expanded. {{{1
    7781variabledescriptors={};
    78 variable_fieldnames=fieldnames(md.variables);
     82variable_fieldnames=fieldnames(md.variables(options.ivar));
    7983for i=1:length(variable_fieldnames),
    8084        field_name=variable_fieldnames{i};
    81         variabledescriptors{end+1}=md.variables.(field_name).descriptor;
     85        fieldvariables=md.variables(options.ivar).(field_name);
     86        for j=1:numel(fieldvariables)
     87                variabledescriptors{end+1}=fieldvariables(j).descriptor;
     88        end
    8289end
    8390
    8491responsedescriptors={};
    85 response_fieldnames=fieldnames(md.responses);
     92response_fieldnames=fieldnames(md.responses(options.iresp));
    8693for i=1:length(response_fieldnames),
    8794        field_name=response_fieldnames{i};
    88         responsedescriptors{end+1}=md.responses.(field_name).descriptor;
     95        fieldresponses=md.responses(options.iresp).(field_name);
     96        for j=1:numel(fieldresponses)
     97                responsedescriptors{end+1}=fieldresponses(j).descriptor;
     98        end
    8999end
    90100%}}}
Note: See TracChangeset for help on using the changeset viewer.