Info

此问题已关闭。 请重新打开它进行编辑或回答。

Hi everybody, I encounter with this error message. : ""Attempt to reference field of non-structure array. "" I would be grateful if you could help.

1 次查看(过去 30 天)
the erorr is in first line:
last = Run.steps(1); % index of last sampled dags
log_score = Run.Log_Scores(last); % the current log score
V_vec = Run.v_vec{last}; % the current couple-uncouple vectors
lambda_coup_vec = Run.lambda_coup_vec{last};
lambda_uncoup_vec = Run.lambda_uncoup_vec{last};
% Output on screen:
fprintf('\n###########################################################\n')
fprintf('The new DBN cpBGe MCMC simulation has been started \n')
fprintf('###########################################################\n')
fprintf('Log-likelihood-value of the initial graph: %1.5f \n',log_score)
fprintf('###########################################################\n\n')
%%%Start of the MCMC simulation
Counter = 1;
for i = last:steps
[log_score,lambda_uncoup_vec, lambda_coup_vec, nue_var,V_vec] = MCMC_INNER( ...
step_iterations, DAG, log_score, MATRIX, DATA_ALL, mue_0, ...
Cov_mat, nue_var, lambda_uncoup_vec, lambda_coup_vec, ...
k_transition,V_vec);
if (i>=floor(steps/2))
Run.Log_Scores(Counter) = log_score;
Run.steps(1) = i+1;
Run.lambda_coup_vec{Counter} = lambda_coup_vec;
Run.lambda_uncoup_vec{Counter} = lambda_uncoup_vec;
Run.v_vec{Counter} = V_vec;
Counter = Counter+1;
end
end
  3 个评论
dpb
dpb 2015-8-13
Ah, my bad on the capitalization, Steven....still, he's got an array it appears that is trying to use as a structure and which 'll show that for certain...(again, presuming he capitalizes it consistently :) )

回答(1 个)

Steven Lord
Steven Lord 2015-8-13
Before you execute that line of code, look at the Run variable. You're trying to index into it as though it was a struct array, but from the error message it is NOT a struct array. My guess is that whatever code you ran to generate the variable named Run did not work as expected, perhaps returning Run as an empty array "placeholder", the array [].

此问题已关闭。

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by