File Exchange

image thumbnail

Load Open Document Spreadsheets

version 1.1 (2.34 KB) by

Loads a spreadsheet in the open document format (used by programs like Open Office) into a cell arra

5 Downloads

Updated

View License

The function provides a simple method with which one can load the contents of open document spreadsheets into MATLAB. Allowing users to directly import files created by Open Office into MATLAB.

Provided with the filename of the spreadsheet the function will import the contents into a MATLAB cell array. The function handles the presence of multiple worksheets by allowing the user to specify a particular worksheet to import.

The function has not undergone rigorous testing, but it has worked for all of my needs. Also, I think a similar method may be implemented to allow one to export data from MATLAB into open document spreadsheets.

Comments and Ratings (9)

K

K (view profile)

Sorry, didn't include the most important part of the error message:

??? Attempt to reference field of non-structure array.

Error in ==> loadods at 57
nodes = node.getChildNodes

K

K (view profile)

Thank you for developing this very useful function. I was wondering if you could help me with a problem in using it.

When I try to use loadods(), I get the following error:

Error in ==> loadods at 57
nodes = node.getChildNodes

This error comes up even with the simplest ods file (1 sheet, 3 numbers). The temporary file content.xls seems to contain correct information.

Would really appreciate your help with this!

Stefan

Stefan (view profile)

OK, submitting a new file was not a good idea. Here are my changed lines:

23 function data = loadods_2010_02_02(filepath,filename,options)

26 if nargin<3, options = []; end

31 if exist([filepath filename])~=2

42 unzip([filepath filename],dir_temp);

Note: the filename of the tool must be loadods_2010_02_02.m or change line 23

Stefan

Stefan (view profile)

Thank for the tool. Now I don't have to use microsoft excel.
Seems to be working on matlab 6.5 R13, too. But there is an issue using filenames containing a complete path (like c:\myfiles\testfile.ods). The line 36 'if ~mkdir(tempdir,filename) fails and the result is 'permission error'. My solution: separating path and filename: loadods(filepath, filename, options).
There are some necessary changes in the lines 23, 26, 31 and 42. I'll try to upload my version (loadods_2010_02_02.m).

Ilya

Ilya (view profile)

diego fonseca

diego fonseca

I made an open office spread sheet, in ods file I made 2 sheets called sheet1 and sheet2, both have different numbers. When I write loadods('filename.ods','sheet1') it gives me a warning saying: MATLAB 7.0.4 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning for details.
Also when I load the second sheet it only displays the first sheet. Is there a bug in the program or I am doing something wrong?

Steven

Steven (view profile)

This is a great tool. I started writing one myself but found this instead. Thanks. Now for the writeods.m tool. Mathworks should put this into their standard toolbox soon.

Andrew Wagner

I too would love to have an ods exporter

Updates

1.1

Updated for BSD licensing change

MATLAB Release
MATLAB 7.4 (R2007a)
Acknowledgements

Inspired: Rosin-Rammler Diagram plotting tool

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video