How to csvwrite an array in HDFS

2 views (last 30 days)
Hi,
I have Matlab connected to a Hadoop cluster. I want to save an array as a csv file to HDFS. The only commend I found was:
location = 'hdfs://master/user/savecsvfile';
write(location, Array1 );
Then I check the HDFS respiratory to find a file "part-1-snapshot.seq" and the contents are different from what Array1 is.
Thanks,

Accepted Answer

Kojiro Saito
Kojiro Saito on 16 Jan 2018
write command is able to write only tall array as .seq file. So, if you want to save csv files to HDFS, you should first save csv files on locla then upload to HDFS using Hadoop commands. From MATLAB,
csvwrite('hoge.csv', Array1);
!hadoop fs -copyFromLocal ./hoge.csv /user/savecsvfile
  6 Comments
Amr Munshi
Amr Munshi on 17 Jan 2018
Thanks a lot! I'm so grateful to you
lov kumar
lov kumar on 7 Jun 2019
How to connect matlab to hadoop cluster.
How to fix this issue:
Parallel mapreduce execution on the Hadoop cluster:
********************************
* MAPREDUCE PROGRESS *
********************************
Map 0% Reduce 0%
Error using mapreduce (line 125)
The HADOOP job failed to submit. It is possible that there is some issue with the HADOOP configuration.
OS: windows

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!