help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (no subject)


From: Lester Anderson
Subject: Re: (no subject)
Date: Fri, 10 Jun 2016 12:26:42 +0100


On 10 June 2016 at 11:59, Doug Stewart <address@hidden> wrote:


It does not require a header on my system
octave dev. 4.1.0+
Ubuntu

 
#
Created by Octave 3.6.4, Fri Feb 14 16:11:23 2014 JST <address@hidden>
#
name: xydata
#
type: matrix
#
rows: 11
#
columns: 2
0
0
0.6283185307179586
0.5877852522924731
1.256637061435917
0.9510565162951535
1.884955592153876
0.9510565162951536
2.513274122871835
0.5877852522924733
3.141592653589793
1.224646799147353e-016
3.769911184307752
-0.587785252292473
4.39822971502571
-0.9510565162951535
5.026548245743669
-0.9510565162951536
5.654866776461628
-0.5877852522924734
6.283185307179586
-2.449293598294706e-016
 
Please use "dlmread" instead.
(For detail see >> help dlmread)

Tatsuro



I am on Octave 4.0.2 Windows GUI. Now, taking the [datafile] = uigetfile('*.txt','Choose a txt file'); etc and placed in a new file (using dlmread), it works. Somewhat confused as to why it does not work in a function file. Just running the following function on its own will not write the matrix A

function loparfi

global psed pm pw
global zt zb
global agetop agebas
global c surpor
global basset
global flagfile
global flagunits
global flagage
global flagdens
global flagporo

%define main parameters for problem

prompt = {'Water density in kg/m^3','Mantle density in kg/m^3'};
def = {'1000.0','3300.0'};
title = 'MAIN PARAMETERS';
lineNo = 1;
answer=inputdlg(prompt,title,lineNo,def);
pw = str2double(answer{1});
pm = str2double(answer{2});

%read parameters from a txt file

[datafile] = uigetfile('*.txt','Choose a txt file');
A=dlmread(datafile);
zt = A(:,1);
zb = A(:,2);
agetop = A(:,3);
agebas = A(:,4);
psed = A(:,5);
c = A(:,6);
surpor = A(:,7);
basset = A(:,8);

flagfile = 1;
flagunits = 1;
flagage = 1;
flagdens = 1;
flagporo = 1;

p.s. hope this is posting in the right place now

reply via email to

[Prev in Thread] Current Thread [Next in Thread]