Create grid of three sources and extract the values of each cell
7 views (last 30 days)
Show older comments
Hi everyone, I am noob programming so I will really appreciate your all your advices :)
I load three different files to create a grid map and i get it. However, now I'm trying to create only one grid map with the values of three files and then i want to extract the value of each cell to create a line chart where X = number of cell and Y = values inside the cell
Could someone help me?
Thank you very much!
Fran
2 Comments
Jan
on 28 Jul 2022
What do you call "a grid map"? What is a "cell"? What is "number of a cell"?
It does not matter, where the data are coming from. Omit details like "loaded from a file", if they do not have a connection to the actual problem. But explain the actual details as exact as possible.
Answers (1)
Siraj
on 29 Sep 2023
Hi!
I understand that you have three separate files, and from each file, you have created a grid map. Now, you want to merge all three grid maps into a single grid map. However, you haven't specified how the combined grid should be organized. For instance, it is unclear whether a new row or column should be added when transitioning from one file to the next, or how the cells should be numbered when merging the grids.
To combine the three separate grid maps into a single grid map in MATLAB, you can use the "cat" function. The specific approach will depend on your requirements and how you want the grids to be merged. The "cat" function allows you to concatenate arrays along a specified dimension. Refer to the following link for more details on how to use the "cat" function.
For additional information on various methods of concatenating and expanding matrices in MATLAB, refer to the following link.
To provide a clearer understanding, I have included a short example code snippet below:
% Define the dimensions of the grids
rows = 2;
cols = 2;
% Generate the first random grid
grid1 = rand(rows, cols);
% Generate the second random grid
grid2 = rand(rows, cols);
% Generate the third random grid
grid3 = rand(rows, cols);
% Concatenate the grids horizontally
final_grid_horizontal_using_cat = cat(2,grid1 ,grid2, grid3)
final_grid_horizontal_using_array_concatenation = [grid1 ,grid2, grid3]
% Concatenate the grids vertically
final_grid_vertical_using_cat = cat(1,grid1 ,grid2, grid3)
final_grid_vertical_using_array_concatenation = [grid1; grid2; grid3]
Hope this helps.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!