1
$\begingroup$

I am really new to data science. Please don't mark me down as this website is my only hope of progress. I have set of data I obtained from NASA website. When I saved it, it saved as "tsv' file. (Tab separated values). I want to open it on Matlab as a Matrix as I have a code to run on that matrix. Basically I want to import that file to matlab and start running the code on it. Can someone please help me or guide me in the right direction.

I tried various things such as import data, tdfread but so far nothing has worked for me. I was first trying to export the tsv file to MS Excel and then go from Excel to Matlab. That too I don't know how to do. I will give you the link of my data which I want to import on to Matlab.

The link for my data is the following.

Please take a look at http://vizier.u-strasbg.fr/viz-bin/VizieR?-source=J%2FApJS%2F209%2F31

If you just click on submit at the lower right corner, one will see the data.

a = importdata('J_ApJS_209_31_table3-150618.tsv') [This the command I used]. Error message on matlab is

    ??? Error using ==> importdata at 136
    Unable to open file.
    Error in ==> data at 1

Then I wrote a script.

    tdfread(J_ApJS_209_31_table3-150618,'\t')

Error message I get is ??? Undefined function or variable 'J_ApJS_209_31_table3'.

    Error in ==> data at 1
$\endgroup$
2
  • $\begingroup$ Could you edit your question and include what command have you tried in Matlab, and what is the specific error that Matlab is throwing? Otherwise, it's difficult to say more than "tdfread is the command listed in the documentation for this kind of task" $\endgroup$ – logc Jun 19 '15 at 7:37
  • $\begingroup$ @logc I edited the question and I have included the command and the error message I get. Would you please be able to help. $\endgroup$ – user5184 Jun 24 '15 at 17:47
1
$\begingroup$

tdfread displays the File Open dialog box for interactive selection of a data file, then reads data from the file. The file should have variable names separated by tabs in the first row, and data values separated by tabs in the remaining rows. tdfread creates variables in the workspace, one for each column of the file. The variable names are taken from the first row of the file. If a column of the file contains only numeric data in the second and following rows, tdfread creates a double variable. Otherwise, tdfread creates a char variable. After all values are imported, tdfread displays information about the imported values using the format of the tdfread command.

tdfread(filename) allows command line specification of the name of a file in the current folder, or the complete path name of any file, using the string filename.

tdfread(filename,delimiter) indicates that the character specified by delimiter separates columns in the file. Accepted values for delimiter are:

' ' or 'space'
'\t' or 'tab'
',' or 'comma'
';' or 'semi'
'|' or 'bar'
The default delimiter is 'tab'.

s = tdfread(filename,...) returns a scalar structure s whose fields each contain a variable.

$\endgroup$
1
  • $\begingroup$ @logc Thank you for replying. I am going to work on it again and will let you know and if it does not work well I will go ahead and edit the question with more detail $\endgroup$ – user5184 Jun 23 '15 at 2:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.