help-octave
[Top][All Lists]
Advanced

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

Re: Loading tick labels from a file


From: Ben Abbott
Subject: Re: Loading tick labels from a file
Date: Mon, 24 Feb 2014 14:05:45 -0500

On Feb 24, 2014, at 1:12 PM, Byron Hawkins <address@hidden> wrote:

> 
> On Feb 24, 2014, at 5:16 AM, Byron Hawkins <address@hidden>
> wrote:
> 
>> I'm trying to make a generic octave script for generating some basic
> plots, and I need to load the tick labels from a file. This works for
> numeric labels:
>> 
>> tick_labels = dlmread(args{4})
>> 
>> But when I have a text label like "1K", it shows up on the axis as "0". I
> tried a variety of other loading functions, but the result was the same. Is
> there a way to specify that the contents are text and should be treated as
> if quoted? Thanks for your help.
>> 
>> Byron
> 
> Can you give us an example of the file you are reading?  Does it contain all
> labels with double quotes on one line? Or one label on each line without any
> quotes, or something else?
> 
> Ben
> 
> I've tried a few ways. When I put them on separate lines, the labels show up
> on the wrong tick marks, so I mostly experimented with them all on one line.
> For example:
> 
> 1,10,100,1K
> 
> And:
> 
> 1,10,100,"1K"
> 
> And:
> 
> 1,10,100,'1K'
> 
> What's the normal way to do this?

Assuming the labels are in "foo.txt" and that the contents of foo.txt is ...

1,10,100,1K

Try ...

        labels = strsplit (fileread ('foo.txt'), ',')

Ben



reply via email to

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