MATLAB Answers

# Find minimum of a 15x100 and return in a vector of 1x100. is this possible?

1 view (last 30 days)
fadams18 on 18 Feb 2020
Edited: Matt J on 18 Feb 2020
I have
i=5 ; nu=150 ;
for j =1:15
load(['output/GC/rank_', int2str(i), '/nu_',int2str(nu),'/NeNMF_GC_', int2str(j), '.mat'], ...
'RRE_AS_V' );
newAS (j,:)= (RRE_AS_V);
end
The variable newAS is 15 x 101 in size. if i do a median it works fine. It returns a 1x101
Median_newAS = median(newAS,1);
However wheni do for min and max it appears the values are swapped when i write to a table
% however for min and max
Min_newAS = min(newAS);
Max_newAS = max(newAS);
I write to a table. but when i examin my min values they look like they are rather the max values. and max values are small
T_AS=table(Min_newAS',Max_newAS',Max_newAS' ,'VariableNames',{'Min_AS','Med_AS','Max_AS'});
namedatfile= ['r_' int2str(i),'_nu_' int2str(nu) '_pass.dat'];
fname = namedatfile;
writetable(T_AS,fname,'Delimiter',' ')

#### 0 Comments

Sign in to comment.

### Answers (1)

Matt J on 18 Feb 2020
Edited: Matt J on 18 Feb 2020
The names of the variables you wrote to the table
Min_AS,Med_AS,Max_AS
are different from the original variable names you showed us,
Median_newAS
Min_newAS
Max_newAS
So, it wouldn't be a surprise if the data you wrote to the table was different from what you computed.

#### 2 Comments

fadams18 on 18 Feb 2020
Sorry actually they are the same i just wanted to simplify the code here for potential solvers. I have edited the question
Matt J on 18 Feb 2020
I suggest you attach newAS in a .mat file, so we can try to reproduce what you see.

Sign in to comment.

Sign in to answer this question.