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: Byron Hawkins
Subject: RE: Loading tick labels from a file
Date: Tue, 25 Feb 2014 13:08:12 -0800

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

------

Actually it works fine even with the error I mentioned in my last reply--or
maybe it is just a warning? I was directing the plot output to the wrong
directory, which made me think the error was terminal. Thanks again for your
help.



reply via email to

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