how to combine three variables from two different .mat files

1 view (last 30 days)
Hello I have two .mat files each containing data that I need to combine and extract. My "grid".mat file has two variables, Y and X, each in the dimensions of my grid.
Y =
2 2 2 (new line)
1 1 1 (new line)
0 0 0
X =
4 3 2 (new line)
4 3 2 (new line)
4 3 2
Combined they make up my "base" grid
A second .mat file contains my data that I need to work with - with individual values for each grid cell.
How do i combined these data into something I can plot, manipulate, etc.?
Thank in advance for any suggestions.
  2 Comments
Stephen23
Stephen23 on 13 Aug 2018
@Kristian Kjeldsen: what have you tried so far? Are you having problems loading the data, or joining it together somehow? So far your question gives no useful information about how the "second" data are arranged or formatted: are they also numeric data, arranged in the same grid?
It would help if you uploaded sample files by clicking the paperclip button.
Kristian Kjeldsen
Kristian Kjeldsen on 14 Aug 2018
@Stephen Cobeldick: I have loaded the data into matlab - and also visualized the data following your suggestion. The second file contains the data (numeric), arranged on the same grid. I have uploaded a 10x10 extraction of each of the data types I'm working with. Hope this helps clarify my problem thanks

Sign in to comment.

Answers (1)

Stephen23
Stephen23 on 13 Aug 2018
Probably all you need is something like this:
S = load('grid.mat');
T = load('second.mat');
X = S.X;
Y = S.Y;
Z = T.whateverthenameofthedatais
surf(X,Y,Z)

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2014a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!