Populate single column of data of engineering format into a 4-D array

Hi guys, I have a single column of data containing exponents: 1.245e-46 3.922e-9 -6.478e-9 8.145e-9 -9.260e-9 10.04e-9 I have 11x73x73x22=1289618 total lines of the above sort of data in a single column file. What i wish to do is to store that data in a (11x73)x73x22 (row*column*page*book) 4-D array. so essentially form it as consecutive (11x73) arrays formed into consecutive 73 pages into consecutive 22 books.

 Accepted Answer

reshape(x, [11,73,73,22])

2 Comments

Hi Walter, Thanks for your response. Is x the array i read in from using tesxtscan? If so, how do i make sure textscan does not approximate the numbers to zero. For example textscan approximates my data to all zeros when i read in with the following: my_data=textscan(fidi,'%d64 %*[^\n]'); my values include negative numbers also. e.g 2e-9, -3e-10 Thanks!!!
Actually a simple x=load('file') followed by the reshape works fine!!!

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!