Effacer les filtres
Effacer les filtres

How do I create an array with the greatest values from two arrays?

3 vues (au cours des 30 derniers jours)
Kylenino Espinas
Kylenino Espinas le 6 Nov 2020
Commenté : Jon le 6 Nov 2020
function [semData] = semProcessing(raw1, raw2)
if length(raw1) = length(raw2)
lg = length(raw1);
semData = zeros(1,lg);
semData(1:end) = ;
end
end
semProcessing([1,3,5,7], [8,6,4,2])
Result: [8,6,5,7]
After doing this line of code I have an array that is filled with 0s and the same size as the two input arrays. How would I write a code that would get the result above?

Réponse acceptée

Jon
Jon le 6 Nov 2020
C = max(A,B)
  1 commentaire
Jon
Jon le 6 Nov 2020
or in your specific example
>> max([1,3,5,7], [8,6,4,2])
ans =
8 6 5 7

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by