Error Scalar Cannot Be Indexed With
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or octave error: load: unable to determine file format of posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join octave unable to determine file format the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes dlmread: unable to open file a minute: Sign up Cannot load a file in Octave up vote 1 down vote favorite Apologies in advance if I get something wrong. This is my first post here (I'm sure there will be many to follow). I have a
Octave Value On Right Hand Side Of Assignment Is Undefined
file I want to load into Octave but it doesn't work. It is a plain text file (.txt). The file is homogeneous and an excerpt of a few lines from it look like this: 0023,225.935,341.770,17.658 0024,225.935,341.758,17.782 LTAX17,228.152,353.935,17.665 LTAX24,288.304,332.878,24.074 where the first column depicts the name of the point while the rest represent its 3D coordinates. Some of the options I've tried (but not limited to these) were unsuccessful. x=load(text.txt) error: scalar cannot be indexed with . error: evaluating argument list element load octave number 1 x=load("-text", "text.txt") warning: load: file found in load path error: load: empty name keyword or no data found in file 'text.txt' x=fileread(text.txt) warning: load: file found in load path error: load: empty name keyword or no data found in file 'text.txt' I have also tried simplifying the file, leaving only the coordinates and treating the file as a CSV but I keep getting similar errors. load octave share|improve this question asked Nov 18 '14 at 13:42 Ovidiu 1013 are you sure 'text.txt' is in the current working directory? i.e. using ls, do you see 'text.txt'? –Alex Nov 19 '14 at 12:38 I've added the path of the working directory using >path and >savepath. Actually I get an warning every time I try loading a file >warning: load: file found in load path which I don't know what it means. Isn't the file supposed to be in a known path in the first place? –Ovidiu Nov 21 '14 at 8:04 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted I think load is only for data files, not for text files. You might to use csvread, dlmread, textscan or textread. Check the documentation as to the correct syntax for invoking each of these functions. Here are the different approaches: load does not work as you found out x = load('test.txt') error: value on right hand side of assignment is undefined csvread wo
this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ octave and oo octave dlmread Hi all, at the moment i work through a tutorial
Octave Csvread
with oo in Matlab http://www.mathworks.com/help/techdoc/matlab_oop/f3-28024.html and octave and try to reproduce the example there: It is about defining a class DocPolynom of polynomials. The constructor seems to work well, function obj = DocPolynom(c) % Construct a DocPolynom object using the coefficients supplied if http://stackoverflow.com/questions/26995793/cannot-load-a-file-in-octave isa(c,'DocPolynom') obj.coef = c.coef; else obj.coef = c(:).'; end end but although it is do easy, the double-method does not: function c = double(obj) % DocPolynom/Double Converter c = obj.coef; end What i obtain is p = DocPolynom([1 0 -2 -5]) p = { coef = 1 0 -2 -5 } octave:16> http://octave.1599824.n4.nabble.com/octave-and-oo-td3040741.html c = double(p) error: struct type invalid as index value I am sure that my m-files are evaluated like char.m defined below, because it produces failures: octave:16> p = DocPolynom([1 0 -2 -5]); octave:17> char(p) error: scalar cannot be indexed with . error: called from: error: /home/ernst/Software/resource/octave/m/@DocPolynom/double.m at line 3, column 3 error: evaluating argument list element number 1 error: evaluating argument list element number 1 error: evaluating argument list element number 1 error: evaluating argument list element number 1 error: /usr/share/octave/3.2.4/m/general/int2str.m at line 105, column 5 error: evaluating argument list element number 1 error: evaluating argument list element number 1 error: /usr/share/octave/3.2.4/m/general/int2str.m at line 69, column 11 error: evaluating argument list element number 1 error: /home/ernst/Software/resource/octave/m/@DocPolynom/char.m at line 36, column 23 what is wrong here?? Greetings, Ernst _______________________________________________ Help-octave mailing list [hidden email] https://www-old.cae.wisc.edu/mailman/listinfo/help-octave John W. Eaton Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ octave and o
#32863] x.y.z syntax for structure fails ("scalar cannot be indexed with .") Date: Sun, 20 Mar 2011 11:35:04 +0000 User-agent: Mozilla/4.0 https://lists.gnu.org/archive/html/octave-bug-tracker/2011-03/msg00170.html (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; http://savannah.gnu.org/bugs/?32863 .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MS-RTC LM 8; .NET4.0C; InfoPath.3) URL:
Statistics Site Help User Docs: Cookbook User Docs: In Depth Guide Get Support Contact Savannah User Docs: FAQ GNU Project Help GNU All GNU Packages Dev Resources License List GNU Mirrors Free Software Foundation Coming Events Free Software Directory Cryptographic software legal notice Copyright infringement notification Related Forges Savannah Non-GNU Gna! Puszcza GNU Octave - Bugs: bug #32863, x.y.z syntax for structure fails... Group Main Main View members Search Homepage Download Mailing lists Source code Use Mercurial Browse Sources Repository Use CVS Browse Web Pages Repository Bugs Submit new Browse Reset to open Digest Export Get statistics Search Tasks Submit new Browse Reset to open Digest Export Get statistics Search Patches Submit new Browse Reset to open Digest Export Get statistics Search bug #32863: x.y.z syntax for structure fails ("scalar cannot be indexed with .") Submitted by: None Submitted on: Sun Mar 20 11:34:55 2011 Category:NoneSeverity:3 - Normal Priority:5 - NormalItem Group:Incorrect Documentation Status:InvalidAssigned to:None Originator Name:Jonathan SchachterOriginator Email:-unavailable- Open/Closed:ClosedRelease:3.2.4 Operating System:Microsoft Windows Post a Comment Add a New Comment (Rich Markup): You are not logged inPlease log in, so followups can be emailed to you. Discussion ( Jump to the original submission) Thu Mar 24 00:21:54 2011, comment #6:If you're goal was to mimic a hash-like structure you can arrange to do that by careful ordering of assignments. See below. tmp_struct.a = 1; tmp_struct.b = 2; x.label1 = tmp_struct; tmp_struct.a = 3; tmp_struct.b = 4; x.label2 = tmp_struct; x x = scalar structure containing the fields: label1 = scalar structure containing the fields: a = 1 b = 2 label2 = scalar structure containing the fields: a = 3 b = 4 Also, you might want to be aware of the () notation which allows you to use variables in place of explicit labels. For example, label = 'hello'; a.(label) = 'world'; a = scalar structure containing the fields: hello = world Rik