Trying to have this result
Details- name:Tara Wilkins, ID:12344567, address:123 Happy Drv
Having errors when using num2str for the ID part, what am I doing wrong?
students(i) = struct();
students(1).ID = 12344567;
students(1).name = 'Tara Wilkins';
students(1).address = '123 Happy Drv';
students(2).ID = 15432123;
students(2).name = 'Fred Bloggs';
students(2).address = '125 Happy Drv';
students(3).ID = 34765765;
students(3).name = 'Jo Tamry';
students(3).address = '321 Happy Drv';
for i = 1:length(students)
disp(['Details- name:' ,students(i).name, 'ID:',students(i).[num2str(ID)], ', address:' ,students(i).address])
end
*Bolded the part that is the issue*
Best Answer