How to edit 2 matrices
Show older comments
Hi everybody,
I have a matrix which is A = [1; 2; 5; 8; 9; 10; 11; 12] and a matrix which contains for pairs of the previous matrix B = [ 1 2; 5 8; 8 9; 9 10 ; 10 11; 11 12 ] I want to complete A but without loosing the pairs in the second matrix. For instance A = [1; 2; 3; 4; 5; 6; 7; 8] B = [ 1 2; 3 4; 4 5; 5 6 ; 6 7; 7 8 ]. How is ti possible to implement this? Thank you in advance
7 Comments
Adam
on 6 Jun 2018
What do you mean by 'complete A'? Please give a full example of expected results. I don't understand how your second definition of A links in any way to the first or what you want the output to be.
DIMITRA GIANNOPOULOU
on 6 Jun 2018
Edited: DIMITRA GIANNOPOULOU
on 6 Jun 2018
Jan
on 6 Jun 2018
What are "floating elements"? I see 3 different definitions of the matrix A, two for matrix B and one for "A B", whatever this means. I cannot follow your explanations yet.
Please post the input data, us unique names for the variables, explain the procedure without freshly invented terms like "complete" or "floating", and post the wanted output.
DIMITRA GIANNOPOULOU
on 6 Jun 2018
"After the exclusion I will have a matrix C = [1;2;5;7;8] which I want to sort it such that C = [1;2;3;4;5]."
This is not the definition of SORT in MATLAB or any other programming language, because you are changing the elements themselves, not just their order (which is how sorting is defined). If you want us to understand then you will have to explain the operation that converts [1;2;5;7;8] into [1;2;3;4;5]. Are those the sort indices ?
DIMITRA GIANNOPOULOU
on 6 Jun 2018
Accepted Answer
More Answers (0)
Categories
Find more on Shifting and Sorting Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!