how to write a matrix operation for subtract
1 回表示 (過去 30 日間)
古いコメントを表示
I have sets of files (but no file extension), like follows (sample has been attached to the thread).
eachfile is 200x200 matrix
depth, depth_00001, depth_00002, depth_00003, depth_00004, depth_00005, depth_00006, depth_00007, depth_00008, depth_00009, depth_00010
I want to write a function to subtract 'depth' file from every other files of depth_00001 to depth_00010 and save the output as slide_00001, slide_00002, etc.
i want to do this at a single program at one time.
Please be kind enough to help anyone knows.
Previously I put the same question and I recived answers but not feasible.
0 件のコメント
採用された回答
Walter Roberson
2024 年 1 月 23 日
M = readmatrix('depth');
files = dir('depth_*');
for K = 1 : numel(files)
infile = files(K).name;
outfile = regexprep(infile, 'depth_', 'slide_');
M_in = readmatrix(infile);
difference = M_in - M;
writematrix(difference, outfile);
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!