FOR loop taking every row from a matrix
显示 更早的评论
I am working with the survey data from an Excel file, it has only three columns: [Depth, Inclination, Azimuth]. This data then is used to plot a trajectory in the subsurface.
At the momemnt, I am building a code that slightly modifies the above values of Inclination and Azimuth with simple formulas. As for now, I have a FOR loop with synthetic data of uniformly increasing Depth [1:200] and constant values of Incl & Azim, that, for each incriment in Depth (going deeper) calculates the new values of Incl. & Azimuth. Since the Incl. & Azim. values are constant, it's easy now to calculate with every new value of Depth.
Next step and problem: I have the real data of the above columns, [Depth, Inclination, Azimuth], say [X,Y,Z,] with random survey values (i.e., no uniformly increasing depth anymore. It does go deeper, but with different intervals each time; same type of change for the other two). I have imported the Excel into MATLAB and created the [3x159] matrix. I now want to incorporate the values in my FOR loop, such that it takes every row for the calculations as follows:
- It takes X1 (Depth1), calculates in some formula the values, e.g. modification = X1+1/3;
- Then it takes Y1, calculates some different values, e.g. Ynew = Y1 + modification;
- Lastly, it grabs Z1, calculates another value, e.g. Znew = Z1 + modification;
And so on it repeats the same concept for X2,Y2,Z2 etc. until it reaches the end of the survey data. It will give me in the end the new matrix [X, Ynew, Znew].
Doesn't seem too complicated to tell the code to take every row of the data, but can't get it? Any help would be appreciated. Thanks!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!