Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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 visualización (últimos 30 días)
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 comentarios
Steven Lord
Steven Lord el 13 de Ag. de 2015
run is a built-in function. Run (with a capital R) is not, though it could easily lead to confusion.
dpb
dpb el 13 de Ag. de 2015
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 :) )

Respuestas (1)

Steven Lord
Steven Lord el 13 de Ag. de 2015
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 [].

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by