HOW TO NORMALIZE MATRIX BASED ON COLUMNS' MAX VALUE?

11 ビュー (過去 30 日間)
Lucia Barragan
Lucia Barragan 2021 年 2 月 18 日
回答済み: Star Strider 2021 年 2 月 18 日
Hello, I'm tryig to normalize separately each column of data in a matrix like T (e.g)
T=5×2 table
LastName Height Age
'Sanchez' 71 29
'Johnson' 69 78
'Lee' 64 14
'Diaz' 67 66
'Brown' 64 88
I used this function: N = normalize(T,'norm',Inf,'DataVariables','Height')
but as this way it uses the max 'Height' value also for the 'Age' column,
i tryed to do N = normalize(T,'norm',Inf,'DataVariables','Height', 'Age')
but it gives me error of inputs...
So, how should I use the function so that each column is normalized by its own max. value?
Thanks!

回答 (1 件)

Star Strider
Star Strider 2021 年 2 月 18 日
Try this:
N = normalize(T,'norm',Inf,'DataVariables',{'Height', 'Age'})
Put multiple variables in a cell array (note the curly brackets {}).

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by