just as an update, I was able to isolate the array I needed by just highlighting it manually in the place were it shows all the cells. Not ideal, and I'd like a loop or function to be doing it, but for now at least I can see if doing the calculations for each element will work.
How to Extract Part of a Specific Column of elements in a 4D array?
8 次查看(过去 30 天)
显示 更早的评论
I have a 147093 x 1 x 1 x 6 double matrix (originally in the form of a .mgh surface file) that I read into matlab. I need to extract the first 3 values of the 6 column for each of the 147093 indices and put them into a formula (it's just calculating the angle between each vector and a constant <0,1,0> vector). Once I get the angle of every 3D vector I need to store the result in 147093 x 1 array so I can use it in another piece of software. I've attached some pictures for reference. One is the dimensions of the array in matlab, the other photo shows the 3 values for each index that I need to extract, and the other 3 that I need to leave out.
How should I go about doing this? I was thinking about writing a nested for loop, but that doesn't seem very efficient because I know Matlab has a lot of built in functions to do this type of stuff, I'm just not very familiar with them. My main problem is figuring out how to extract the exact values I need. Because I don't even want the other 3 values in the 6 column, it will mess up the calculation.
Thanks for any advice.
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!