MATLAB: How to multiply arrays in struct file with a variable

arraystruct

Best Answer

The load functions loads to a struct, where each variable is a field, even when you specify only a single variable. The code below should do the trick.
filename1 = sprintf('Zy%d', low);
temp=load('Z.mat', filename1);
c = a * temp.(filename1);
filename2 = sprintf('Zy%d', high);
temp=load('Z.mat', filename2);
d = b * temp.(filename2);
If you're working on Octave the following syntax might work as well
d = b * load('Z.mat', filename2).(filename2);
Related Question