Max Min value in every column Of Matrix

20 ビュー (過去 30 日間)
Ace_ventura
Ace_ventura 2015 年 2 月 10 日
コメント済み: Stephen23 2016 年 1 月 11 日
I Have a code that gives me some output in my command window as a 9 by 80 matrix. I want that when I run the program and it gives me output in the command window, the max and min value should stand outin some way in each column so that I don't have to find them by looking at each row and each column. They could be either bold or underlined or coloured . I dont know how to do it. Or is it even possible?. If not, can you suggest any other way?
  8 件のコメント
Ace_ventura
Ace_ventura 2015 年 2 月 11 日
Thanks per isakson
Stephen23
Stephen23 2016 年 1 月 11 日
See per Isakson's Answer, it actually answers the question asked.

サインインしてコメントする。

採用された回答

Stalin Samuel
Stalin Samuel 2015 年 2 月 11 日
here i have given a example for you
a = [1:5;6:10;11:15;16:20;21:25]
a=a'
[x y] = size(a)
axis([0 x 0 y])
for i=1:x
for j=1:y
if a(i,j)==max(a(i,:))
text(i,j,[ num2str( a(i,j))],'Fontsize',30)
hold on
else
text(i,j,[ num2str( a(i,j))],'Fontsize',20)
hold on
end
end
end
  2 件のコメント
Ace_ventura
Ace_ventura 2015 年 2 月 11 日
Thanks Stalin
Stephen23
Stephen23 2015 年 2 月 11 日
編集済み: Stephen23 2015 年 11 月 4 日
@Stalin Samuel: Note that you should not use i or j as loop variable names, as these are the names of the inbuilt imaginary unit.
Also note that consistent indentation makes code easier to follow. Please consider using the MATLAB Editor's default code indentation and formatting in order to make your cod more readable.

サインインしてコメントする。

その他の回答 (1 件)

per isakson
per isakson 2015 年 2 月 10 日
編集済み: per isakson 2015 年 2 月 10 日
"the max and min value should stand out in each column" &nbsp AKAIK: formatting the output in the command window is not available in the standard Matlab. However, I think it's a good idea and that it can be realized with a small function based on one of these File Exchange contributions
"is there no way to get max and min values out of matrices of my output file??" &nbsp I don't understand this question. The word "file" doesn't appear in the original question. There are functions to calculate min and max.

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by