"Sprand" problem
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Wayne King
2012년 4월 26일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!