How can I break the two different ranges in the vector apart?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
A C
am 16 Sep. 2018
Beantwortet: Image Analyst
am 16 Sep. 2018
How can I break the two different ranges in the vector apart?
a = [7:17:302 primes(300)];
b = [7:17:302; primes(300)];
OR
b = [7:17:302];
c = [primes(300)];
2 Kommentare
Walter Roberson
am 16 Sep. 2018
What does it mean to break them apart?
The values 7 41 109 211 are in both ranges.
If you know the length of one of the two parts you can use indexing.
Image Analyst
am 16 Sep. 2018
It looks like you did break them apart. Isn't that what b and c are? If not, then what are they?
Akzeptierte Antwort
Image Analyst
am 16 Sep. 2018
Do you perhaps mean this:
a = [7:17:302 primes(300)];
plot(a, 'b-', 'LineWidth', 2);
grid on;
index = find(diff(a) < 0);
b = a(1:index)
c = a(index+1:end)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195789/image.png)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Historical Contests finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!