I am trying to read a simple xls file with xlsread in octave. Its csv version is shown below:
2,4,6
8,10,12
14,16,18
20,22,24
I have run the following commands in octave:
# the next commands are to select the file through a gui.
# it reports a warning, but selects the filename correctly
>> pkg load io
>> fprintf('Select the training data file ... \n');
Select the training data file ...
>> filename = uigetfile({'*.xls'; '*.xlsx'}, 'File Selector');
Gtk-Message: 14:37:32.971: GtkDialog mapped without a transient parent. This is discouraged.
>> printf('file name %s\n', filename);
file name x1.xls
# now I am trying to read the xls, and I get an error:
>> [~, ~, RAW] = xlsread(filename);
Detected XLS interfaces: None.
warning: xlsopen.m: no '.xls' spreadsheet I/O support with available interfaces.
warning: xlsread: some elements in list of return values are undefined
warning: called from
xlsread at line 268 column 1
I am using octave-4.2.2 on ubuntu-18.04 LTS. What is the reason for this error? Is there any other package that I need to install? How do I fix this problem?
octave supports xlsx, not xls.
Related
I entered this code on my octave GUI on Mac:
>>cd file:///Users/Sudipta/Downloads/Stanford/warmUpExercise.m
error: file:///Users/Sudipta/Downloads/Stanford/warmUpExercise.m: No such file or directory
I am using macOS Big Sur and Octave version 3.8.0.The file in question exists in my computer and I have checked this code multiple times.
It is not able to locate the file on my MacBook for some reason. Can someone help?
Edit: I have tried a new code as mentioned in the comments, but it also can't find the file
>> cd Users/Sudipta/Downloads/Stanford/warmUpExercise.m
error: Users/Sudipta/Downloads/Stanford/warmUpExercise.m: No such file or directory
I have also tried:
1.>> cd Users/Sudipta/Downloads
error: Users/Sudipta/Downloads No such file or directory
2.>> cd Users/Sudipta/Downloads/Stanford
error: Users/Sudipta/Downloads/Stanford No such file or directory
And I got the same error as above.
The other code gave a different error:
3.> cd /Users/Sudipta/Downloads
warning: load_path: .: Operation not permitted
QKqueueFileSystemWatcherEngine::addPaths: open: Operation not permitted
Warning: QFileSystemWatcher: failed to add paths: /Users/Sudipta/Downloads
i'm doing a program in octave in which i got
t=0:.0002:20;
Gs=tf(100,[1 10])
u1=sin(t);
y1=lsim(Gs,u1,t);
plot(t,9.95*sin(t-0.1),’r’,t,y1,’b’)
However when i write Gs=tf(100,[1 10]) in the command window it appears "warning: the 'tf' function belongs to the control package from Octave Forge which
you have installed but not loaded. To load the package, run 'pkg load
control' from the Octave prompt."
How can i load this package? I trully can't understand it...
enter image description here
enter image description here
When i load it it appears:
pkg load control
warning: addpath: C:\Octave\OCTAVE~1.0\mingw64\share\octave\packages\control-3.2.0: No such file or d
irectory
warning: called from
load_packages_and_dependencies at line 48 column 5
load_packages at line 47 column 3
pkg at line 461 column 7
t=0:.0002:20;
Gs=tf(100,[1 10])
error: could not find any INDEX file in directory C:\Octave\OCTAVE~1.0\mingw64\share\octave\packages
control-3.2.0, try 'pkg rebuild all' to generate missing INDEX files
error: called from
describe>parse_pkg_idx at line 94 column 5
describe at line 59 column 40
pkg at line 555 column 43
unimplemented>check_package at line 540 column 15
unimplemented at line 127 column 11
In the octave terminal, type
pkg load control
To load the control package. If you do not already have the control package installed, you need to install it. You can do so directly from Octave Forge by typing
pkg install -forge control
Note that this will install this package in your predefined 'prefix'. You can find where that is by typing
pkg prefix
If you're not sure if you have the control package installed, you can check the list of already installed packages by typing
pkg list
Type help pkg to see more details about how octave's package manager works.
In any case, the tf function belongs to the control package, and like all packages, you need to load it before you can use its functions.
Having said this, even after loading the control package, your above code doesn't work. It seems like you're calling the tf function using the wrong format.
In a program I have csv extracted from excel, I need to upload the csv to hdfs and save it as parquet format, doesn't matter with python version or spark version, no scala please.
Almost all discussions I came across are about databrick, however, it seems cannot find the file, here is the code and error:
df = sqlContext.read.format("com.databricks.spark.csv").option("header", "true").option("inferSchema","true").option("delimiter",",").load("file:///home/rxie/csv_out/wamp.csv")
Error:
java.io.FileNotFoundException: File file:/home/rxie/csv_out/wamp.csv
does not exist
The file path:
ls -la /home/rxie/csv_out/wamp.csv
-rw-r--r-- 1 rxie linuxusers 2896878 Nov 12 14:59 /home/rxie/csv_out/wamp.csv
Thank you.
I found the issue now!
The reason why it errors out of file not found is actually correct, because I was using Spark Context with setMaster("yarn-cluster"), that means all worker nodes will look for the csv file, of course all worker nodes (except the one starting the program where the csv resides) do not have this file and hence error out. What I really should do is to use setMaster("local").
FIX:
conf = SparkConf().setAppName('test').setMaster("local")
sc = SparkContext(conf=conf)
sqlContext = SQLContext(sc)
csv = "file:///home/rxie/csv_out/wamp.csv"
df = sqlContext.read.format("com.databricks.spark.csv").option("header", "true").option("inferSchema","true").option("delimiter",",").load(csv)
Yes, you are right, the file should be present at all worker nodes.
well. you can still read a local file in yarn cluster mode. you just need to add your file using addFile.
spark.sparkContext.addFile("file:///your local file path ")
spark will copy the file to each node where executor will be created and can be able to process your file in cluster mode as well.
I am using spark 2.3 version so you can change your spark context accordingly but addFile method remains same.
try this with your yarn (cluster mode) and let me know if it works for you.
I have a file sitting in my Cloudera project under "/home/cdsw/npi.json". I've tried using the following commands to use PySpark for reading from my "local" CDSW project, but can't get at it with any of the following commands. They all throw the "Path does not exist: " error
npi = sc.read.format("json").load("file:///home/cdsw/npi.json")
npi = sc.read.format("json").load("file:/home/cdsw/npi.json")
npi = sc.read.format("json").load("home/cdsw/npi.json")
As per this documentation, Accessing Data from HDFS
From terminal, copy the file from local file system to HDFS. Either use -put or -copyFromLocal.
hdfs dfs -put /home/cdsw/npi.json /destination
where, /destination is in HDFS.
Then, read the file in PySpark.
npi = sc.read.format("json").load("/destination/npi.json")
For more information:
put
put [-f] [-p] [-l] <localsrc> ... <destination>
Copy files from the local file system into fs. Copying fails if the file already
exists, unless the -f flag is given.
Followed the 2x options for commands at: https://www.mediawiki.org/wiki/Manual:Importing_XML_dumps#Using_importDump.php,_if_you_have_shell_access
In both instances, getting a 'failed to open stream' error.
I have chmod 777 for folder and file. (Thinking it may be permission error)
I have moved the file to import right into the maintenance folder (some postings suggesting PHP needs to be able to find the file, so think putting it there will help)...
on command:
"root#bitnami-mediawiki-___:/opt/bitnami/apps/mediawiki/htdocs/maintenance# php importDump.php --co
nf ../LocalSettings.php /FILENAME.xml"
I see error:
"PHP Warning: fopen(/FILENAME.xml): failed to open stream: No such file or directory in /opt/bitnam
i/apps/mediawiki/htdocs/maintenance/importDump.php on line 267
PHP Warning: feof() expects parameter 1 to be resource, boolean given in /opt/bitnami/apps/mediawiki/
htdocs/includes/import/ImportStreamSource.php on line 41
PHP Warning: fread() expects parameter 1 to be resource, boolean given in /opt/bitnami/apps/mediawiki
/htdocs/includes/import/ImportStreamSource.php on line 48
PHP Warning: feof() expects parameter 1 to be resource, boolean given in /opt/bitnami/apps/mediawiki/
htdocs/includes/import/ImportStreamSource.php on line 41
PHP Warning: XMLReader::read(): uploadsource://9115d0bbe5ae974e1fe2d411e035aeaa:1: parser error : Ext
ra content at the end of the document in /opt/bitnami/apps/mediawiki/htdocs/includes/import/WikiImport
er.php on line 551
PHP Warning: XMLReader::read(): in /opt/bitnami/apps/mediawiki/htdocs/includes/import/WikiImporter.p
hp on line 551
PHP Warning: XMLReader::read(): ^ in /opt/bitnami/apps/mediawiki/htdocs/includes/import/WikiImporter.
php on line 551
Set $wgShowExceptionDetails = true; in LocalSettings.php to show detailed debugging information."
I'm not clear what the error means and how to grant access to the file... Newb to BASH and servers. Any help would be greatly appreciated!
It looks to me that the path of the FILENAME.xml file is wrong. Note that you have a / at the beginning of FILENAME.xml, so it will look at the root of the filesystem. If the file is in the same folder, then use ./FILENAME.xml