Why modyfing view do not lead to modification of source array

I took the liberty of editing your post to change block (text) quotes to use code quoting instead — please use that in the future to help make your posts more readable.

On the actual question, I really want to dissuade you from using Meta.parse and eval. Instead, you can use selectdim to just do this operation for you (if I’m understanding it correctly).

Ok, that’s still not addressing the actual question… the root of the challenge you asked about is that TwoDimRawDat has its dat field defined as an Array{T,3}. This doesn’t support views and will convert (and thus copy) any non-Array as needed/able. If you want your TwoDimRawDat struct to support holding views, you need to change that field to also allow SubArrays (likely by allowing all AbstractArrays in general).

6 Likes