필터 지우기
필터 지우기

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