MATLAB: How to define variables like d12 d23 d24 and so on from a vector containing the values of d and a vector containing the indices

for loopindexingloopsvector

So I have this table of data which is for information of streams from a point to another. So they're given like this right now in my PDF
I don't want to make 20 lines for d12=0,1;d23=0.08;, etc so I thought of trying to somehow have the values and indices in separate vectors then assign the values to 10 different variables (10 more for the L's) in a for loop. But I can't think of how to achieve this. Right now I have
% Define indices
ind=num2str([12 23 24 34 35 45 36 57 58 49]);
% Define d's
d=[.1 .08 .08 .1 .08 .08 .09 .09 .09 .09];
d2=d.^2;
(the last step is because we will be using only the squares of the d's anyway so might as well assign the squares to my new variables). So I want to somehow use a loop and get d12=.1, d23=.08, L12=1000, L23=800 and so on with 2 for loops instead of 20 lines of assigning variables. I can't use arrays like d(1), d(2), etc like we usually do because it's difficult to keep track of what streams the d and L is for then.

Best Answer

Use cell arrays d{12}, d{23} and so on.