clear cInfo; fid = fopen('wages.txt','rt'); count = 0; while not(feof(fid)) cInfo = textscan(fid,'%d %s %f',1); cont = cont +1; employee(cont).id = cInfo{1}(1); employee(cont).category = cInfo{2}{1}; employee(cont).salary = cInfo{3}(1); end; fclose(fid);
It was just one part of the code, I get the error in 'employee(cont).id = cInfo{1}(1);'
Content of 'wages.txt':
34 Agent 150074 Manager 200066 Manager 170099 Programmer 1500
Best Answer