MATLAB: Using file for graph data file I am looking for make 3 dimensional graph with data file There are three paramter (file name, x, y). Could you share matlab code or example? please find attached file Best Answer Try thisfilenames = {'11.txt','22.txt','33.txt'};data = cell(1,numel(filenames));for i=1:numel(filenames) data{i} = readmatrix(filenames{i});endfig = figure();ax = axes();hold(ax);grid onview(3);for i=1:numel(filenames) plot3(data{i}(:,1), data{i}(:,2), i*ones(size(data{i}(:,1))), 'LineWidth', 1)endax.ZTick = 1:3;ax.ZTickLabel = filenames;xlabel('x');ylabel('y');zlabel('filenames'); Related SolutionsMATLAB: How to read two files simultaneously files = dir('*.txt') ;N = length(files) ;for i = 1:N thisfile = files(i).name ; % do what you want, load and plotend MATLAB: How to process multiple Excel files using the same Matlab code for each If you can make a cell array of the filenames, eg.filenames = {'this file.csv','that file.csv','oh this file too.csv'}then you can write a loop over that cell array:for fn = filenames xlsread(fn{:}, 'A1:D80421');endIf you need to pull the file names from the directory, then you can use the what or ls commands. Related Question3d plotting of Lat, Long and depthHow to make three dimensional gragh3D line of best fitPlot 3D Vector
Best Answer