n-dimensional

OpenCL: Work items, Processing elements, NDRange

自作多情 提交于 2019-11-29 02:50:11
问题 My classmates and me are being confronted with OpenCL for the first time. As expected, we ran into some issues. Below I summarized the issues we had and the answers we found. However, we're not sure that we got it all right, so it would be great if you guys could take a look at both our answers and the questions below them. Why didn't we split that up into single questions? They partly relate to each other. We think these are typical beginner's questions. Those fellow students who we

How do I get the two last dimensions of an N-D array as a 2D array?

为君一笑 提交于 2019-11-28 03:11:19
问题 I have a 3D array in MATLAB, with size(myArray) = [100 100 50] . Now, I'd like to get a specific layer, specified by an index in the first dimension, in the form of a 2D matrix. I tried myMatrix = myArray(myIndex,:,:); , but that gives me a 3D array with size(myMatrix) = [1 100 50] . How do I tell MATLAB that I'm not interested in the first dimension (since there's only one layer), so it can simplify the matrix? Note: I will need to do this with the second index also, rendering size(myMatrix)