×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

having trouble putting data into one matrix
2

having trouble putting data into one matrix

having trouble putting data into one matrix

(OP)
I am trying to add matrix A and matrix B to matrix C
Here are my example Matrices
A=[5;4;3;2;1];
B=[6;8;7];
This is what I want
C=[5;4;3;2;1;6;8;7]

RE: having trouble putting data into one matrix

C=[A;B]

RE: having trouble putting data into one matrix

(OP)
Thank you IRstuff and Asixth, that will be very helpful.
Here is my code, I forgot to say that I am trying to Augment many files of different sizes togther to make one Mx1 matrix. the files range in size from 5 to 21 in length. this is the part of my code that does not work:
   OX(ma:m,1) = NDPSORBIT_OX_m
the rest works, theoretically I thought this would work. can you point out my error please and lead me in the right direction? Thank you very much.


% Loads Data
[PathName, File, s2, srtlist] = UserData;
ma = 1;
for i=1:10
% Gets the Data
    [filename] = GetDataMat(File, PathName, i);
% Loads the first file
    load (filename)
    % 'MxN'
    mn = size(Net_array);    % Size of the Matrix
% retrieves M % M= number of scans
   m = mn(1,1); n = mn(1,2);   
% Gets the info wanted from the file's variable
    NDPSORBIT_OX_m = Net_array(1:m,2);
% Theoretically grabs the Matrices and concatenates them %into one matrix: this is the part that does not work
    OX(ma:m,1) = NDPSORBIT_OX_m
% indexes the length of each matrix and adds the next one to % keep things in order
    ma = ma +m
end

RE: having trouble putting data into one matrix

(OP)
I figured out what i was doing wrong, I was not indexing the m correctly

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources