How do I define a structure that has an element which is an array and for which there are sub elements. I have composed a simple example below of what I want to do along with a failed attempt at the needed assert statements.
function y = payroll(personnel) %#codegen
% Specify the class of the input as struct.
assert(isstruct(personnel));% Specify the class and size of the fields r and i
% in the order in which you defined them.
assert(isa(personnel.num_employees,'int32'));assert(isa(personnel.employee,'int32'));assert(all(size(personnel.employee) == [5 1]));assert(isa(personnel.employee(1).salary,'int32'));for i = personnel.num_employees total_payroll = total_payroll + personnel.name(i).salary;endy = total_payroll;end
Best Answer