choosing function in array problem
1 次查看(过去 30 天)
显示 更早的评论
In this case i want to / already take(n) the biggest Absol-value, because of that i have to process the number in 'Pos' and 'Value', sequentially 11 and -3.4. what i want to ask is:
- what function did i have to use to take value of 'Pos' and 'Value' separately and combined ? so far i just learn about max/min and other functions but it's only dscribe itself and not other data
- could you give me the example of this with value of 'Value' and 'Pos' separately and combined taken? thanks alot for this to help my study in make thesis :)
much love
data in MATLAB is simplified like this
Table = [ 1 2 3 4 5; %Number
7 8 9 11 15; %Pos
0.8 1.5 3 -3.4 2; %Value
0.8 1.5 3 3.4 2;] %Absol-value
choose_abs_tab = max(Table(4,:))
% we get the value of choose_abs_tab is at cell (4 , 4)
%after this step i want to take data at cell (3,4) and cell(2,4)
%problem asked is what i write it
6 个评论
采纳的回答
Dyuman Joshi
2022-9-22
Table = [ 1 2 3 4 5;
7 8 9 11 15;
0.8 1.5 3 -3.4 2;
0.8 1.5 3 3.4 2;];
[maxabsval,maxid] = max(Table(4,:)) %this will get the first index of maximum value in the row
Separate
pos=Table(2,maxid)
val=Table(3,maxid)
Together
valpos=Table(2:3,maxid)
2 个评论
Dyuman Joshi
2022-9-22
编辑:Dyuman Joshi
2022-9-22
I can suggest you to go through the MATLAB documentation -
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!