Extract data from fileDatastore and cell

2 ビュー (過去 30 日間)
M M Nabi
M M Nabi 2021 年 10 月 19 日
回答済み: BhaTTa 2024 年 7 月 19 日
read(fds)
ans =
struct with fields:
data: {178093×3 cell}
Cell data is somthing like that
{1×1×9 double} {10×20×3 single} {[0.4343]}
How can extract all rows and but 1 and 3 number columns such as only {1×1×9 double} {[0.4343]} using fds.data ?

回答 (1 件)

BhaTTa
BhaTTa 2024 年 7 月 19 日
To extract specific columns (in your case, columns 1 and 3) from a cell array and obtain all rows, you can use MATLAB's cell array indexing. Given that fds.data is a cell array with dimensions {178093×3}, you can extract the desired columns as follows:
% Extract all rows but only columns 1 and 3
extractedData = fds.data(:, [1, 3]);
% Display the size of the extracted data to confirm
disp(size(extractedData));
% Display the first few rows of the extracted data to verify
disp(extractedData(1:5, :));

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by