Hi - I am new to Python and am converting some MATLAB code over. I have a question about converting MATLAB nested variables (is that the right term for this?) with varying sizes and dimensions into Python. Is there a way in Python to set up my variable below, filedata(x).shiftinfo.numapples(y,z), equivalently in Python? I'm not sure how to ask without an example. My stripped-down MATLAB example code is below.
files = ['C:\temp\day1.dat','C:\temp\day2.dat']; % Files to read (1 file for each day apple pickers worked) for x = 1:numel(files) % Loop over each file [fid,msg] = fopen(files(x),'r','b'); % Open for reading binary data numShifts(x) = fread(fid,1,'uint32'); % Read # of worker shifts on that day for y = 1:numShifts(x) % Now loop over the shifts filedata(x).numFarmers(y) = fread(fid,1,'uint32'); % Read number of farmers working that shift for z = 1:filedata(x).numFarmers(y) % Now read number of apples picked by each farmer on that shift. filedata(x).shiftinfo.numapples(y,z) = fread(fid,1,'uint32'); end end endRight now I'm just storing one set of z values at a time and bookkeeping x,y indices for that entry. Is there a better way?