フィルターのクリア

How do I read data from just first row of the cell

69 ビュー (過去 30 日間)
Bajdar Nour
Bajdar Nour 2018 年 8 月 17 日
回答済み: Adusumilli Bala Surendra 2019 年 4 月 24 日
this is the 3x50 cell
  4 件のコメント
Image Analyst
Image Analyst 2018 年 8 月 17 日
madhan, no. Just try it and see
for row = 1 : 3
for col = 1 : 50
ca{row, col} = rand(1, 4);
end
end
row1 = ca(1,:) % Correct.
row1 = ca{1,:} % Incorrect.
The first way gives the entire row while the braces way gives only the first cell of the first row. See the FAQ on cell arrays.
madhan ravi
madhan ravi 2018 年 8 月 17 日
Thank you sir @ Image analyst

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

採用された回答

Image Analyst
Image Analyst 2018 年 8 月 17 日
Bajdar, just specify 1 for the first index of the cell array feature_vec.
array17 = feature_vec{1, 7} % Get array contained in row 1, column 7 of the cell array.
If you want all the arrays in all the cells of row 1, then you can do:
row1 = feature_vec(1,:) % row1 is another cell array - a row vector cell array.
Here row1 is a cell array that is a row vector of 50 cells. Each of those 50 cells contains a double array. To get any particular array in a specified column, use braces. For example to get the cell in the 8th column, do
cellContents18 = row1{8}; % Contents of the 8th cell will be a double array.
If you don't understand when to use braces (to refer to contents of the cell) and parentheses (to refer to the cells themselves), then see <https://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F the FAQ on cell arrays.) Don't worry - granted, it's a very tricky and confusing thing that is hard for a lot of people to grasp.
  5 件のコメント
Bajdar Nour
Bajdar Nour 2018 年 8 月 20 日
I have 3 different types of images each type contains 50 images..all images have been saved in 3X50 cell array..I want to separate each of them independently and save each one as .dat file (like row1.dat , row2.dat ,row3.dat) { Hint1: each image is double array and 9 features have been calculated. Hint2:feature_vec is .mat file}
Image Analyst
Image Analyst 2018 年 8 月 20 日
I don't see any reason to save/store all the images. Why are you doing that? Just process them in the loop and be done with that image.

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

その他の回答 (2 件)

Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018 年 8 月 17 日
編集済み: Yuvaraj Venkataswamy 2018 年 8 月 17 日
if true
feature_vec{1,:}
end
  2 件のコメント
Bajdar Nour
Bajdar Nour 2018 年 8 月 19 日
Thanks, Yuvaraj V
Yuvaraj Venkataswamy
Yuvaraj Venkataswamy 2018 年 8 月 20 日
You are welcome

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


Adusumilli Bala Surendra
Adusumilli Bala Surendra 2019 年 4 月 24 日
The following can help you. Try this.
z =
1×3 cell array
{3×3 double} {3×3 double} {3×3 double}
>> z{1}
ans =
0.00315 + 0.011925i 0.0008042 + 0.0071843i 0.0008042 + 0.0061306i
0.0008042 + 0.0071843i 0.00315 + 0.011925i 0.0008042 + 0.0065829i
0.0008042 + 0.0061306i 0.0008042 + 0.0065829i 0.00315 + 0.011925i
>> z{1}(1,:)
ans =
0.00315 + 0.011925i 0.0008042 + 0.0071843i 0.0008042 + 0.0061306i

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by