how to format rows columns for display

4 ビュー (過去 30 日間)
FIR
FIR 2011 年 11 月 16 日
I have 5 columns and 800 rows and the last row contains percentage ranging from (90.20 to 99.98),first i want to round off that percentage ans have to display it withs all its column and ten i want to select two percentage which is highest and want to dispaly with all its 5 columns
The input is
1 2 1 0 93.06
1 3 1 0 97.06
2 1 0 0 99.09
.
.
.
.
800 0 1 0 98.36
i need the output as
2 1 0 0 99.09
800 0 1 0 98.36
assuming for example 98 and 99 are highest
ten i have to calculate CV error for the third column,have to use in built function,please help

採用された回答

Sven
Sven 2011 年 11 月 16 日
Hi FIR,
Make data:
D = [(1:800)' randi(4,800,1) rand(800,1)+99];
Display all data rounded:
disp(round(D))
Display the top two percentages:
[~,sortOrder] = sort(D(:,5),'descend');
disp(D(sortOrder(1:2),:))
If you want it to come out exactly like your question text (ie, without decimal places for the first 4 columns):
fprintf('%5d %d %d %d %0.2f\n',D(sortOrder(1:2),:)')
I don't know what "CV error for 3rd column" means - I think that it's a completely separate question.
  2 件のコメント
FIR
FIR 2011 年 11 月 17 日
Thanks Sven ,CV means cross validation I have to find cross validation for the third column,
Next is ,i have 100 gene ,cluster the 100
data into 20 groups using the K-means method
si i will lhave in first column the cluster number(1 to100)
2nd column-total no of genes(ex 3)
genes included (9,7,8)
can u help please
Sven
Sven 2011 年 11 月 17 日
No problems, FIR.
Once again, hit accept on this question and try and if you have a specific problem you encounter, clarify exactly what it is in a new question. I'm afraid that I've got no background at all if the question involves genetics but I'm sure someone here can help.

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

その他の回答 (1 件)

DSP Masters
DSP Masters 2011 年 11 月 17 日
use 'reshape' function in matlab

カテゴリ

Help Center および File ExchangeLarge Files and Big Data についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by