i have a cell like this image
i want to get the maximum value from valeu of column 2 to 5. when i using cell2mat function, i get the error. so, how to convert the value of column 2 to 5 to be vector so i can get the maximum value ? thanks

3 件のコメント

Jan
Jan 2016 年 4 月 24 日
編集済み: Jan 2016 年 4 月 24 日
You show us the contents of "data" and a variable "a.nilai". The error message means, that "a.nilai{2,1}" is not a cell. But how could we know which variable you want to process? And what do you assume to be the "maximum" of a list of complex values?
ElizabethR
ElizabethR 2016 年 4 月 24 日
Thanks for answare,
ooh i am sorry, this is the right image:
the variable i want process is "nilai" .. yes, i want to get the maximum value from value in column to 5 is it possible that i get the maximum from complex values ?
Stephen23
Stephen23 2016 年 4 月 25 日
編集済み: Stephen23 2016 年 4 月 25 日
@eliz: instead of asking random strangers why not just simply read the MATLAB documentation max, and see what it says about complex numbers. The documentation is great: it tells us how MATLAB works.

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

 採用された回答

Jan
Jan 2016 年 4 月 24 日

0 投票

Perhaps something like:
V = [b{:, 2:5}]

4 件のコメント

ElizabethR
ElizabethR 2016 年 4 月 24 日
i have tried this, and it working. thanks jan. God Bless ^^ may i ask again ? is it possible that i get the maximum from complex values ??
Image Analyst
Image Analyst 2016 年 4 月 24 日
Did you see my answer where I used max()?
ElizabethR
ElizabethR 2016 年 4 月 24 日
yes i see, but i mean, is possible that i get the maximum value from complex number ?
ElizabethR
ElizabethR 2016 年 4 月 26 日
@Jan Simon how to get all value only from column 2 ?? thanks

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2016 年 4 月 24 日

0 投票

Did you try something like this
col5 = nilai{:, 5};
magCol5 = abs(col5);
[maxValue, indexOfMax] = max(magCol5)

5 件のコメント

ElizabethR
ElizabethR 2016 年 4 月 24 日
thanks for answare ^^
yes, i have tried that. but, after the process of magCol5 = abs(col5); the value become only 0,7184 and before the value is 0.7184 - 0,0010i. so, my question, is the value 0.1784 same with 0,1784 - 0,0010i ??
Image Analyst
Image Analyst 2016 年 4 月 24 日
You just don't have enough deciaml places to see that it's slightly different. Try
format long g
and then look and you'll see it's slightly longer than the real-only part of the number.
ElizabethR
ElizabethR 2016 年 4 月 25 日
how to use format long g ?
Image Analyst
Image Analyst 2016 年 4 月 25 日
Just put it as a line in your program, or type it at the prompt in the command window.
ElizabethR
ElizabethR 2016 年 4 月 26 日
編集済み: ElizabethR 2016 年 4 月 26 日
i have been tried it. thanks yo so much image analyst ^^ whether the format long g convert a decimal number with lots value after the comma to only 14 number after the comma?? i try to using format long g in my function, but this output is same like i don't use format long g thanks

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

質問済み:

2016 年 4 月 24 日

コメント済み:

2016 年 4 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by