セルのデータを抽出する方法
11 views (last 30 days)
Show older comments
%これで、実行をすると、tempの行列となり、その1行1列にma曲げのデータが格納されてしまいます。
%これの抽出するにはどうすれば良いでしょうか。
Excel_name = '試験結果.xlsx';
sheet_name = {'ma曲げ', 'mo曲げ', 'ma座屈', 'mo座屈', 'FEM解析_ma', 'FEM解析_mo'};
for k = 1:numel(sheet_name)
temp{k} = readmatrix(Excel_name, 'sheet', sheet_name{k}, 'range', 7);
end
%例えば、temp1 = temp(1,1), temp2 = temp(1,2)というふうにしたいのですが...
0 Comments
Answers (1)
Atsushi Ueno
on 18 May 2023
Edited: Atsushi Ueno
on 18 May 2023
readmatrix 関数の Range オプションでデータの開始セルを7行目としていますが、これにより一つのシートから一つのスカラ値が得られると仮定します。下記の例では7行目の代わりに3行3列目としました(添付ファイルを確認願います)。もしこの仮定が違ってたらコメント等でお知らせください。
各シートの値が一つのベクトルにまとまった事が確認できました。
Excel_name = '試験結果.xlsx';
Sheet_name = sheetnames(Excel_name);
for k = 1:numel(Sheet_name)
temp(1,k) = readmatrix(Excel_name, 'sheet', Sheet_name(k), 'range', [3 3]);
end
temp % 例えば、temp1 = temp(1,1), temp2 = temp(1,2)というふうにしたいのですが...
See Also
Categories
Find more on ワークスペース変数と MAT ファイル in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!