how can i dynamically change a file name in dlmwrite?
Show older comments
I am trying to make it so that when a file is uploaded the "name2" of my code will change to match the source file that the data was taken from. Code below.The pieces of code that i want to match are bold and italic.
fid = uigetfile('.dat');
[pathstr, name2 ,ext] = fileparts(fid);
S = importfile(fid); name = S.textdata;
x = S.data(:,1); y = S.data(:,2);
n = length(x);
a = ones(n,1); b = (1:n)'; z = zeros(n,1);
m = [a b x y z ; 1 0 0 0 0];
dlmwrite('coords_ name2 .txt',m,' ')
Accepted Answer
More Answers (0)
Categories
Find more on File Operations 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!