フィルターのクリア

How to efficiently: Access and store row of cell value

1 回表示 (過去 30 日間)
balandong
balandong 2017 年 5 月 4 日
編集済み: KSSV 2017 年 5 月 4 日
Dear Coder, The objective was to access value in a row of cell and transfer it to other structure. Is there other efficient way than using for loop as shown below.
for i = 1:2650
feature_set (i,1) = Patient.sub_band{i, 1}.feature; end
Thanks in advance for the insight.

採用された回答

KSSV
KSSV 2017 年 5 月 4 日
Are you looking for something like this?
%%create a radnom sturcutre
for i = 1:2650
Patient.sub_band{i, 1}.feature = rand;
end
% Now extract
all_features = [Patient.sub_band{:}] ;
feature_set = [all_features(:).feature] ;
  1 件のコメント
KSSV
KSSV 2017 年 5 月 4 日
編集済み: KSSV 2017 年 5 月 4 日
balandong Commented:
Dear KSVV, thanks for the proposed technique, indeed it is efficient then the for loop. For example, the time taken to process the data using FOR-LOOP and your-approach is 0.01050 sec and 0.00650 sec, respectively. In addition, your line is more tidy if the more DOT FEATURES are to be processess.
Thank you

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by