PDA

View Full Version : Matlab eval Function error


mashiling
Aug12-10, 04:38 AM
Dear Friends/Experts,

I have below code for execution but got error. Any anyone pin point and correct me please?

function H = autclus

for i = 1:500
V = eval(['G' int2str(i)]);
end

end

??? Error using ==> eval
Undefined function or variable 'G1'.

Error in ==> autclus at 10
V = eval(['G' int2str(i)]);

n.karthick
Aug12-10, 09:14 AM
Why can't you use like this

for i=1:500

v{i}=strcat('G',int2str(i));

end

mashiling
Aug12-10, 10:14 AM
Why can't you use like this

for i=1:500

v{i}=strcat('G',int2str(i));

end

Hi,

Thank you very much for the reply.
If it's using array, I have a little problem here as i will subsequently use this function.

H = dendrogram(Z, 'labels', V);

maybe this is the reason i attempted for eval. any alternative? mate.. :)
Im still a rookie in matlab