To add more detail, what i have tried in excel is to take the differnece in time points (since each point is identical expect for the loop) to try and show where i need to split the column. This is a looooong process though using excel and then i am trying to maually copy and paste each segment into a new colunm repsectivly.
Parse 1 large column of uneven data into an array of columns by nth rows.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Everyone, this may be a very easy question, and as i mentioned in previous work i am a biochemist trying to apply some basic (I think basic) metlab to help expidite data managemnet. I have a text file that is 4 colunms by 136000 rows (ish). (see attached text). I am running a loop where voltage is constnat and current is measured. The time between each measuremnt is identical OTHER then when the loop occurs creating some larger time gap. I want to extract each loop in reshape (neat metlab word i recently leanr haha) the text so that each colunm is one loop for however many loops there are.
So.. the data file is to large and it wont let me attach. I can explain the data in more detail if needed.
7 comentarios
Respuestas (1)
Bjorn Gustavsson
el 11 de Nov. de 2022
If your file contains an equal number of samples for every "loop" and the files contains data from full "loops". Then something like this should work:
n_per_loop = 37; % adjust
idx_time_var = 1; % index to the column with the time-stamps
sz_data = size(datasmaple);
n_loops = floor(sz_data(1)/n_per_loop); % this should get us the number of full loops
% This should extract the time-stamps and put them in an
% [ n_per_loop x n_loops ] array
t_all = reshape(datasmaple(1:(n_per_loop*n_loops),idx_time_var),n_per_loop,n_loops);
for i2 = setdiff(1:sz_data(2),idx_time_var) % Here we loop over the other columns
% Extract those columns reshape them and put them into a cell-array
data_cell_format{i2} = eshape(datasmaple(1:(n_per_loop*n_loops),i2),n_per_loop,n_loops);
end
HTH
13 comentarios
Ver también
Categorías
Más información sobre Get Started with MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!