how to find max and min value from .mat file and save it to an other array?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Muhammad Umer
le 22 Sep 2015
Réponse apportée : Thorsten
le 22 Sep 2015
for i=1:10
j(i)=i*0.5:
end
j = sort( j );
save('j.mat', 'j');
how can i find the max and min value from j.mat and save it to an other array?
0 commentaires
Réponse acceptée
Thorsten
le 22 Sep 2015
S = load('j.mat', 'j');
minmax = [min(S.j) max(S.j)];
save('jminmax.mat', minmax);
0 commentaires
Plus de réponses (1)
Nobel Mondal
le 22 Sep 2015
Looks like the input array is already being sorted before saving into matfile. Now all you have to do is load the file, and get the first and last elements from the array.
>> load j % Here j is the matfile name
>> min_num = j(1); % Here j is array variable name
>> max_num = j(end); % Here J is again variable name
>> new_array = [min_num max_num];
2 commentaires
Nobel Mondal
le 22 Sep 2015
Modifié(e) : Nobel Mondal
le 22 Sep 2015
While saving the matfile, probably the variables were not saved properly. Can you try "clear all", then double click on the j.mat file and see if any variable comes up in the Workspace window?
Voir également
Catégories
En savoir plus sur Structures 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!