Basically I export .dat
files, with headers, from a software and then I use data in them in Matlab. I am making a general function in Matlab which could read the data from the .dat
files I export from the software. Can you tell me the way I can input the name of the .dat file as function's argument?
function [property_without_headers]=gslib_file_to_matlab_var(nModel,nCell)
%% Reading directly from the .dat files generated from SGEMS and making the data of file as a variable
gslib_file_name=input('Enter the gslib file name: ','s');
property_gslib_format=textread('gslib_file_name.dat','%f\t','headerlines',nModel+2);
property_without_headers=reshape(property_gslib_format,nModel,nCell)';
So I was thinking that file's name stored as string gslib_file_name
could be used in gslib_file_name.dat
as the textread
argument. But its not working that way.