How to separate array from array of arrays

  • Follow


Hello
I don't know if what I wrote in subject makes any sense. I have an array in which there are two entries, which are again arrays (one is numbers and one is text). Like I have entry called NEWDATA1 in workspace and in NEWDATA1 , there are entries called 'data' and 'textdata'. I want to  separate 'data' (which is a column of numbers) from NEWDATA1. I actually imported a file (concfromcmg1.txt) which looks like  
Global Mole Fraction(SOL)	2000-01-01	1,1,1’    *SRF-FORMAT   	           0
Global Mole Fraction(SOL)	2000-01-03	1,1,1’    *SRF-FORMAT       0.705627
Global Mole Fraction(SOL)	2000-01-05	1,1,1’    *SRF-FORMAT       0.851589
Global Mole Fraction(SOL)	2000-01-07	1,1,1’    *SRF-FORMAT   	      0.9123
Global Mole Fraction(SOL)	2000-01-09	1,1,1’    *SRF-FORMAT   	     0.94413
and then I used:

newData1 = importdata('concfromcmg1.txt', DELIMITER, HEADERLINES);
% Create new variables in the base workspace from those fields.
vars = fieldnames(newData1);
for i = 1:length(vars)
    assignin('base', vars{i}, newData1.(vars{i}));
end

which gave me that NEWDATA1.
But I dont know how to separate data from NEWDATA1, and I need to do it, so that I can rename it in the code itself, as I ave 1000s of files to import.
Thank you in advance
0
Reply dhirajsingla15 (7) 6/6/2012 10:50:06 PM


0 Replies
46 Views

(page loaded in 0.023 seconds)


Reply: