The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Extracting data from cell array
Replies: 1   Last Post: Jun 25, 2013 10:23 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 1
Registered: 6/25/13
Extracting data from cell array
Posted: Jun 25, 2013 4:29 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I'm importing data from a file, and it imports as a nx1 cell array. To use the data, i need to store each row into different variables, and split up the strings into date, number, and so on. Using deal, i can assign different variables [a b c d.....]=deal(sorted_end{:}), but is there a way to make the length of the [a b c d...] vector vary without having to write in each letter for every time the length of the data file changes?

% Importing the data and analyzing it
delimiterIn = '\t';
getfile = uigetfile('C:\Users\franziska\Desktop\Ingrid\MATLAB\\*.*');
data = importdata(getfile,delimiterIn);

%Size of data
n = size(data);
N = n(1);
entry = N/4;

%Size of sorted cell array without header
sorted = sort(data);
sorted_end = sorted(1:end-entry);
m = size(sorted_end);
M = m(1);
[a b c d e f] = deal(sorted_end{:});

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.