How to access a row elements of a field of a structure

41 ビュー (過去 30 日間)
Mekala balaji
Mekala balaji 2020 年 5 月 1 日
回答済み: per isakson 2020 年 5 月 1 日
Hi,
I have a structure A and it has three feils f1,f2,f3. f2 have three rows and 10 columns. I want to access row 2 of columns.
I did like this but it give error.
A.f1{2,1}
How to access? kindly help.
  2 件のコメント
per isakson
per isakson 2020 年 5 月 1 日
The value of A.f1 is that a double matrix or a cell array?
Mekala balaji
Mekala balaji 2020 年 5 月 1 日
2nd row is is double.

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

回答 (1 件)

per isakson
per isakson 2020 年 5 月 1 日
Assumption: "three rows and 10 columns" refers to a 3x10 double matrix
Try
%%
A.f1 = randi( [0,9], 3, 8 ); % sample data
A.f1( 2, : )

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by