I'm manually converting a code in C to MATLAB.
The code contains assignments like the following,
y[10] = p[32]+(p[31]-p[32])*pow(p_c[0],p[34])/(pow(p_c[0],p[34])+pow(p[33],p[34]));
To use it in MATLAB, I am manually increasing the value of all indexes by 1, since the index in MATLAB starts from 1.
y[10+1] = p[32+1]+(p[31+1]-p[32+1])*pow(p_c[0+1],p[34+1])/(pow(p_c[0+1],p[34+1])+pow(p[33+1],p[34+1]));
Is there an easy way of doing this task? There are around 30 assignments like the above example and I am trying to avoid doing this manually.
Edit 1: Would it be possible to use regular expression? I can copy all the lines of code that contain assignment in a text file. Using regular expression, if I can locate [35](any number) replace with [35+1]. I'm not sure how to implement this in a code.
Edit 2:A sample of other assignments in the code.
y[0] = ct[0]-x[12];
y[1] = ct[1]-1*x[10]-x[23];
y[3] = p_c[6]+p_c[5];
y[4] = p_c[2];
y[5] = x_c[23]+x_c[10]+y_c[1];
y[6] = y_c[0]+x_c[12];
p[0] = 30;
p[1] = 12;
p[2] = 2;
p[3] = 0;
p[4] = 90;
p[5] = 45
dx[0] = FunctionForD(p[67], p[64], p[66], p[65], p[23], x_c[0], x_c[3], p[49])*p[23]-FunctionForA(y[28], y[29], p[23], y[16])*p[23]+FunctionForD(y[30], y[31], p[23], y[16])*p[23]-FunctionForA(p[134], p[133], p[132], p[130], p[131], p_c[2], p[23], x_c[21], x_c[0], p[49])*p[23]; //
dx[1] = FunctionFor2(p[169], p[167], p[168], p[166], p[23], x_c[1], x_c[17], p[49])