substract and make answer to write as an output file
Show older comments
Please anyone who can understand to this problem let me know the solution.
Your kind support is highly appreciated
all these files are 200x200 matrices.
fdir1 = 'depth'; % this is the initial file.
I want to substract above file from all the other depth files 'depth_00001' to 'depth_03600' and write the output as 'slide_00001' to 'slide_03600'.
fdir1 = 'D:/Mejena_Case/NHWAVE_DeformSlide_ReducedArea/results_orig/';
fdir2 = 'D:/Mejena_Case/NHWAVE_DeformSlide_ReducedArea/results_orig/';
ini_depth_file = fdir1;
% load the initial depth file
dep_init = load([ini_depth_file 'depth']);
% given name for the depth file want to read
slide_dep_file = fdir2;
% load the required depth file
depth_data = load([slide_dep_file 'depth_00139']);
% read the the load files in fdir1 and fdir2
dep_init = readmatrix([ini_depth_file 'depth']);
depth_data = readmatrix([slide_dep_file 'depth_00139']);
% operation function
slide = (depth_data-dep_init);
% save the output file in to the same directory
writematrix(slide, "slide_00139.txt", "Delimiter",',');
type("slide_00139.txt")
Accepted Answer
More Answers (0)
Categories
Find more on Particle & Nuclear Physics 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!