Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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 ]
Ingrid

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?

CODE:
% 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]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.