Dear Philip,
Thank you very much for your prompt reply. And I repeated exactly what
you’d done an it worked perfectly. That made me look closer at my old
Matlab code; and I found the problem.
I use a standard section of code for reading data from ascii text files
(that have comments with % in column 1). This code is shown below
%-------------------------------------------------------------------------
% 1. Call the User Interface (UI) to choose the input data file name
% 2. Concatenate strings to give the path and file name of the input file
% 3. Strip off the extension from the file name to give the rootName
% 4. Add extension ".out" to rootName to give the output filename
% 5. Concatenate strings to give the path and file name of the output file
%-------------------------------------------------------------------------
filepath = strcat('d:\temp\','*.txt');
[infilename,inpathname] = uigetfile(filepath);
infilepath = strcat(inpathname,infilename);
rootName = strtok(infilename,'.');
outfilename = strcat(rootName,'.out');
outfilepath = strcat(inpathname,outfilename);
%--------------------------------------------------------------------------
% 1. Load the data into an array whose name is the rootName
% 2. set fileTemp = rootName
% 3. Copy columns of data into individual arrays
%--------------------------------------------------------------------------
**load(infilepath);
**fileTemp = eval(rootName);
*fileTemp = load(infilepath);
serial = fileTemp(:,1);
X = fileTemp(:,2);
sX = fileTemp(:,3);
Y = fileTemp(:,4);
sY = fileTemp(:,5);
sXY = fileTemp(:,6);
The ‘offending’ lines are marked with ** and are now removed and
replaced with the line marked *
Thanks for your help.
Regards
Rod Deakin
1/443 Station Street
BONBEACH, VIC, 3196
Australia.
PS I’m a retired lecturer from RMIT University in Melbourne, Australia
and I’ve been using Matlab (crudely) for many years. But I no longer
have a licensed copy of Matlab. So I’ll be using Octave from now on.
*From:* PhilipNienhuis <mailto:address@hidden>
*Sent:* Sunday, 8 January 2017 9:36 AM
*To:* address@hidden <mailto:address@hidden>
siko1056 wrote
> I saved your file as `Pearson_Line_Data.txt` and ran the following
> commands without problems on Octave 4.2.0 using Linux (openSUSE
> Tumbleweed):
>
>>> load Pearson_Line_Data.txt
>>> Pearson_Line_Data
> Pearson_Line_Data =
>
> 1.00000 0.00000 0.10000 5.90000 0.10000 0.00000
> 2.00000 0.90000 0.10000 5.40000 0.10000 0.00000
> 3.00000 1.80000 0.10000 4.40000 0.10000 0.00000
> 4.00000 2.60000 0.10000 4.60000 0.10000 0.00000
> 5.00000 3.30000 0.10000 3.50000 0.10000 0.00000
> 6.00000 4.40000 0.10000 3.70000 0.10000 0.00000
> 7.00000 5.20000 0.10000 2.80000 0.10000 0.00000
> 8.00000 6.10000 0.10000 2.80000 0.10000 0.00000
> 9.00000 6.50000 0.10000 2.40000 0.10000 0.00000
> 10.00000 7.40000 0.10000 1.50000 0.10000 0.00000
... and on Windows I get the same results Kai.
Philip
--
View this message in context:
http://octave.1599824.n4.nabble.com/load-function-with-ascii-text-file-tp4681305p4681311.html
Sent from the Octave - General mailing list archive at Nabble.com.
_______________________________________________
Help-octave mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/help-octave