I had to update MATLAB recently from 2008 to 2014.
MATLAB's importdata no longer outputs just an array of useable values if there's any non-number text in the file. Testing shows that if I remove all my comments from my file, importdata returns the required data.
I tried something like this
structure = importdata('filename.txt')
structure.data
but my first line, which has a comment at the end of line (and thus non-number text) gets cut off. I have a bunch of comments throughout my data files and I'd rather not have to remove all my comments.
This answer seems out of date.
Is textscan the only way to fix this?
Data file I've been working with.
% Vin: 5 MHz 6.5 mV pk-pk
% ADRF: Pre: 6 dB, Filt: 31 MHz, VGA: 28 dB, Post: 12 dB
% VGain Vin Vout
0 6.51 4.55 % Dirty input
40 6.52 4.57
70 6.54 4.60
110 6.55 4.88
160 6.54 6.21
200 6.53 7.83
240 6.54 10.36
270 6.53 12.95
320 6.53 18.10
360 6.52 24.70
400 6.52 32.20
440 6.51 44.60
480 6.51 57.90
520 6.52 79.50
560 6.51 105.3
600 6.53 147.9
640 6.54 195
680 6.53 272
720 6.51 357
760 6.50 500
800 6.50 677
840 6.47 881
880 6.47 993
920 6.47 1012
960 6.47 1012
1000 6.47 1012
importdataof 2008. For this file it'd return a 25x3 double the first line of which would be0 6.51 4.55. Howeverstructure.data(1,:)currently returns40.0000 6.5200 4.5700- David%in a line? - Divakar%- Davidtextscanis the easiest way to go. Or you do some batch processing in advance. - Robert Seifertimportdatais not a built-in function, the code is easily accessible. You can just copy the file 'importdata.m' from your old Matlab 2008 and copy it in your new Matlab path (would be wise to change the name though). Then use this old version instead of the latest one. - Hoki