Filter löschen
Filter löschen

Large For Loop Executions

4 Ansichten (letzte 30 Tage)
Ayman Esmat
Ayman Esmat am 27 Okt. 2014
Kommentiert: Ayman Esmat am 28 Okt. 2014
Hello Everybody,
I need to execute a for loop for a matrix (34 x 24) which will result in a matrix with 6e36 rows and 24 columns. Of course when I try to do that, matlab gives me the truncating error.
I know its very huge but I want to know if there is a way to execute that large "for loops"?? And if there is a faster way of course that would be great.
Thanks in advance,
  6 Kommentare
Adam
Adam am 27 Okt. 2014
Well, as Mohammad Abouali points out below, I really don't see how you can hope to do this on the data size you say - the disk space required is monolithic. There must be massive redundancy in what you are trying to do...to go from 24*36 to data sizes that are bigger than human comprehension cannot be a solution to whatever problem you are trying to solve.
Even if you had enough disk size to store this, no human nor algorithm could hope to make use of such a vast amount of data.
Ayman Esmat
Ayman Esmat am 27 Okt. 2014
Well like I said, for me its all about all the different combinations of these numbers. Further in my code, I'm going to decide which combination I will choose and which I will eliminate. But it seems that my approach to the problem was wrong. I need to rethink it.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Mohammad Abouali
Mohammad Abouali am 27 Okt. 2014
How do you want to store that in memory?
6e36*24 elements stored at 1B an element (uint8) requires more than 1.34e29GB of memory. I don't think you can even store that in a hard drive, let alone on memory.
Are you sure about your sizes?
  10 Kommentare
Mohammad Abouali
Mohammad Abouali am 27 Okt. 2014
you are welcome
Ayman Esmat
Ayman Esmat am 28 Okt. 2014
Dear Sir, I tried ur code and it worked properly. Thank u very much for ur help.
Although, I have a question. In my original code, I constructed the result matrix column by column. And then after the matrix is fully constructed. I start another loop checking the values of each row according to my conditions and omitting the rows that are not feasible to me. (Number of columns doesn't change) Now with ur code, the result could be constructed row by row which is very helpful to me; I can check each row the moment its given to me in the loop and I can decide whether its feasible or not. Matlab won't have to store all the values of the matrix like my old code did, now it will store only the feasible values I want. My question is, since I won't need to store all the row values in case of my huge matrix of 6e36 rows (the 24 columns can't be changed). I only need certain rows which are feasible to me. Can I put the condition of omitting the unwanted rows in ur code so it will store the feasible rows and not store all the possible rows and run the matlab for loop for n=1:6e36 . Can this be done or am I circling in the same dilemma again?
Thanks again for ur help..

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by