Ahora está siguiendo esta pregunta
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
Create a 4D array from 3D array with 3 columns, and 1D (row only) array with 3 columns
4 comentarios
Respuesta aceptada
24 comentarios
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1591741/image.jpeg)
- First off, I appreciate your follow-up. Thank you.
- Second, I could have done a better job explaining, and also naming the variables. Let me try to explain what I know or what I think I know.
- I have a test data file (.mat file) that contains simulated data, received from somewhere. I don't know what went into its making, or how it was created. When I load that file into Matlab, I can see that the variable name is 'xyz' and its size is 3x241x161x161, a 4D variable as we have been discussing.
- I also have another test data file, that has simulated magentic field data. Exact similar structure (3x241x161x161), only the variable name is different ('field'). Below, let me explain about 'xyz'.
- A note that came along with the test data file says that the first dimention of the 'xyz' variable has values for x, y, z coordinates, this I could also confirm as shown in the image snippet I posted earlier. The 2nd, 3rd and the 4th dimension of 'xyz' are the dimension of a region of space where cubic grids are created.
- My understanding is that first, the program constructs a region of space of 241x161x161 grid-units.Then the program creates grids (cubes). The note also mentions that a fixed grid-size of 0.25 has been used, so, for example, for the test data, there will be 241/0.25 = 964 cubic grids, 161/0.25 = 644 cubic grids and again 644 cubic grids along the x, y and z direction.
- Now that was with the simulated data.
- Next, I want to use my own data, real data (in the sense of "not-simulated"). I have two sets of data, (i) a 3D array of size 576x3x4 for x,y,z coordinate values, and (ii) another same size 3D array for magnetic field (Bx, By, Bz) values. For my own data, I wanted to create a region of space that is 100x100x100 grid units, and say, I will use the same grid size of 0.25. So you see, the total grid space dimension is not fixed. For simulated data, it happend to be 241x161x161, for my own data, I wanted to use 100x100x100. Actually, the total grid dimension will be calculated by the min and max values in each (x, y, z) column, but it complicates the explanation, so for now, I wanted to use 100x100x100.
- I will use a different name for my variable from now on. I want to create, say a 'myXYZ' variable that has x,y,z coordinate values of size 576x3x4 in its 1st dimension, and 100, 100, 100 in its 2nd, 3rd and the 4th dimension.
- Once I know how to create 'myXYZ', I will create 'myFIELD' variable similarly.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1592716/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1592721/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1593421/image.png)
Más respuestas (2)
1 comentario
2 comentarios
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1593351/image.png)
Ver también
Categorías
Etiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Se ha producido un error
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia-Pacífico
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)