cutting a matrix A into 3 pieces with respect to matrix B
Mostrar comentarios más antiguos
here we have :
A=[1 2 3 14 15 16 7 8]
B=[1 2 3]
we know location of B is over 14 15 16 of matrix A.
we need to get 3 different matrix as below:
c=[1 2 3]
d=[14 15 16]
e=[7 8]
whar are the commands? many thanks in advance
13 comentarios
Walter Roberson
el 17 de Jul. de 2015
Is the location within A known, or is it necessary to search A to find [14, 15, 16] ?
Image Analyst
el 17 de Jul. de 2015
Explain how you know that [1,2,3] is "over" [14,15,16]. And what does that even mean - "over"? And since c is identical to B does that mean c is also "over" A (whatever that means)? But since the values of B matches up with the values of A in indexes 1 through 3, I would think that A would be "over" the first 3 elements of A rather than over elements 4-6. Please clarify.
Mori
el 17 de Jul. de 2015
Mori
el 17 de Jul. de 2015
Mori
el 17 de Jul. de 2015
Azzi Abdelmalek
el 17 de Jul. de 2015
This is not clear!
Image Analyst
el 17 de Jul. de 2015
Clear as mud. Perhaps you can use strfind() or ismember() but that's just a wild guess.
Image Analyst
el 17 de Jul. de 2015
Your plot shows two curves, supposedly for A and B. But it doesn't match up with your example, and I don't know how c, d, and e would show up there. Most confusing is that the curves are plots of (x,y) coordinates whereas you don't have (x,y) pairs for A and B. If we are to assume that the x coordinate is the index, and the y coordinate is the value of A or B, then B should be plotted over on the left since it has indexes only from 1 to 3.
And you didn't answer my question about if c gives the same result as B. Why the silence? Do you not need our help anymore? If so, that's fine, just say so.
Walter Roberson
el 17 de Jul. de 2015
Mortaza commented earlier "YES, EXACTLY but sometimes, they don't have exact x value, just difference as 0.0002" in response to arun
Walter Roberson
el 17 de Jul. de 2015
Is it known that those entries in B are bit-for-bit copies of the entries in A? Such as if A was indexed to produce B? Because when two floating point values are computed by even very very slightly different code, the results will not necessarily be equal due to floating point round-off. If the entries are not bit-for-bit copies then you will need to compare with a tolerance rather than compare for equality.
Mori
el 17 de Jul. de 2015
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Get Started with Industrial Communication Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

