Info

此问题已关闭。 请重新打开它进行编辑或回答。

Calling unique rows in vectors

1 次查看(过去 30 天)
James Connor
James Connor 2015-10-23
关闭: MATLAB Answer Bot 2021-8-20
I have 2 row vectors
Remainder = 50 10 30 20 60 40 50 10
Quotient = 1 7 1 4 2 8 5 7 1 4 2 8 5
How would I produce something to show the repeating and non repeating parts in the Quotient. say x= the non repeating parts and y=the repeating parts. So we would have x=[1] y=[7 1 4 2 8 5].
Another example say you have Quotient=[5 0 0] and the Remainder =[0 0 0] I would like to output x=5 and y=0
I think we should use the Remainder to show this because that when it shows what repeating so when the remainders are both 50 that is the repeating part of the quotient. Is it possible to create a code that works for all Quotients and Remainders. Thank you for the help
  2 个评论
Image Analyst
Image Analyst 2015-10-23
Please explain. x appears 3 times (repeats itself twice) in Quotient. Why do you say it's non-repeating? Is it in a stetch of numbers that is too short? Do you have a minimum length of numbers that you want to check for?
If you want to "show the repeating and non repeating parts in the Quotient" then why do you care about the Remainder at all? Why is the Remainder vector needed at all to find the repeats in the second vector.
What would be your answer for this:
Quotient = [1 7 1 4 2 8 5 7 1 4 7 1 4 2 8 5 1 7]
714 is in there 3 times, 17 is in there twice, 14 is in there 3 times, 714285 is in there twice, etc.
James Connor
James Connor 2015-10-23
Sorry, I will try to clarify. take the fraction 7/12 in decimal form. It is 0.5833333333333 and so on. the first decimal .58 does not "repeat" itself the 3rd decimal and onwards is just 3 repeated. I would like code to produce x=[5,8] to show the non repeating part and y=[3] to show the repeating part.
If I type 7/12 into my code I get
Quotient= 5 8 3 3 3 3 3 3 Remainder= 10 4 4 4 4 4 4 4
Another example
3/4
Quotient=[7,5,0,0,0,0,0] Remainder=[2,0,0,0,0,0,]
x should =[7,5] y should =0
I hope this helps.

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by