"Sprand" problem
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I use MATLAB Version 7.8.0.347 (R2009a)
I want to use the "sprand" command, but when I use this two commands below I get conflicting answers.
this one works well:
sprand(100,50,0.1,1e-2);
but this one says that there is an error: sprand(100,50,0.01,1e-2); ??? Error using ==> rand Size vector must be a row vector with real elements.
Error in ==> sprand at 39 i = fix( rand(nnzwanted, 1) * m ) + 1;
Error in ==> sprand at 122 ak = sprand(m,1, nzpc/m);
I am confused. What is the problem?
0 comentarios
Respuestas (1)
Wayne King
el 26 de Abr. de 2012
Hi Atta, I think perhaps you have some non-MathWorks function on your path that precedes the MathWorks' version. That line should work in R2009a.
If you enter
>>which rand
Do you get something like the following?
built-in (.../toolbox/matlab/randfun/rand)
Perhaps you have another version of rand() in your installation?
If
>>which rand
does not return the above, either remove the other file from your path, or remove the folder it is located in.
0 comentarios
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!