Errors when 'bridging' two programmes together.
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I am currently working on a toolbox, where I have created plugins to create a nicer user interface.
It's a pretty long program but hopefully what I have supplied below is enough please ask for more info in required.
I have tried to set the format so it is easy to read...I hope it has worked!!
User-interface code (menu):
cv_none = cfg_const; % For if no covariates are used (default)
cv_none.tag = 'cv_none';
cv_none.name = 'None';
cv_none.val = {1};
cv_none.help = {'Covariate value = none'};
cov_Val = cfg_entry; %For if a covariate value needs to be entered...enter value
cov_Val.tag = 'cov_Val';
cov_Val.name = 'Enter Number of Covariate';%arbitary name
cov_Val.help = {'Help'};
cov_Val.strtype = 'e';
cov_Val.num = [Inf 1];
cv_one = cfg_branch; %Text display of this option in menu
cv_one.tag = 'cv_one';
cv_one.name = 'Enter Different Covariate Value';
cv_one.val = {cov_Val};
cv_one.help = {'Help'};
covariate = cfg_choice; %Menu showing an option
covariate.tag = 'covariate';
covariate.name = 'Covariate'; %arbitary name
covariate.val = {cv_none };
covariate.help = {'Help'};
covariate.values = {cv_none cov_Val };
%% Executable Branch
snpmui = snpm_cfg_ui(DesNm,DesFile,DesHelp,{covariate}); % In the configure file (separate)
Code for the plugin to be able to run the software (where the errors are pointing me towards!):
if BATCH
covariate = job.covariate(:);
if ~all(size(covariate)==[nScan,1])
error(sprintf('Covariate [%d,1] does not match number of subjects [%d]',...
size(covariate,1),nScan))
end
else
covariate = [];
while ~all(size(cov_Val)==[nScan,1])
covariate = spm_input(sprintf('Enter covariate values
[%d]',nScan),'+1');
covariate = cov_Val(:);
end
end
The error I am getting when I insert '12' into the space for "Enter covariate value"
------------------------------------------------------------------------
Running job #1
------------------------------------------------------------------------
Running 'MultiSub: One Sample T test on diffs/contrasts'
Failed 'MultiSub: One Sample T test on diffs/contrasts'
Error using ==> snpm_pi_OneSampT at 115
Covariate [1,1] doesn't match number of subjects [12]
In file
"C:\Users\Emma\Documents\Project\snpm10_devel\snpm_pi_OneSampT.m" (???), function "snpm_pi_OneSampT" at line 115.
In file "C:\Users\Emma\Documents\Project\snpm10_devel\snpm_ui.m" (???), function "snpm_ui" at line 297.
In file "C:\Users\Emma\Documents\Project\snpm10_devel\config\snpm_run_ui.m" (???), function "snpm_run_ui" at line 12.
The following modules did not run:
Failed: MultiSub: One Sample T test on diffs/contrasts
Thank you for reading, I appreciate you're time :)
Emma T
0 个评论
采纳的回答
Walter Roberson
2011-4-6
You haven't given us enough code to work with, but from the output message we can see that you are hitting the condition BATCH which is overwriting the structure "covariate" that it has set up, with whatever is in "job.covariate(:)" . You haven't give us any information about what is in "job", but if there is any consistency with the code proceeding that, I would expect that job.covariate would be a structure array with a single array member; the code before that point does not attempt to create a structure array, so there is no reason to think that there would be one structure array element per subject.
Perhaps the BATCH condition should be testing the size of covariate.values or covariate.val .
2 个评论
Walter Roberson
2011-4-6
"job" cannot be a function, as it is not allowed to use a structure reference off of a function call as would be the case for
covariate = job.covariate(:)
"job" is perhaps a variable that the output of "Job" has been assigned to, but there is no obvious structure assignment in the code you showed for "Job", and no "function" statement either.
The G and Gc variables that are calculated in the code you show, which are commented as having to do with the covariances, are plain numeric variables, not structure variables. If either of them is being returned as job.covariances then that would be a numeric array and then as I noted earlier you would be overwriting a structure array with a numeric array, which your description of BATCH would indicate is not what you want.
Anyhow, in the first executable line of snpm_pi_OneSampT after job is initialized, put a breakpoint, and check what the type and size is of job and job.covariance .
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!