Can some one help me why this command is not working to convert this vector into matrix form having each row should be three columns. So order of new matrix should be should be 5x3. i need this command so far i can use it for nxn matrix.

조회 수: 5 (최근 30일)
G =[0 0 0 +0.2000i -0.2500i +0.0500i 0 0 0 -0.2000i +0.2500i -0.0500i 0 0 0]
??? Undefined command/function 'G2mat'.
Error in ==> fullloop at 49
[mat,padded] = G2mat(G,3)
>> [mat,padded] = G2mat(G,3)
??? Undefined command/function 'G2mat'.\
Can some one help me why this command is not working to convert this vector into matrix form having each row should be three columns. So order of new matrix should be should be 5x3. i need this command so far i can use it for nxn matrix.
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2014년 8월 27일
Rizwan - try to limit your question header to something simple and concise. There is no need to paste four lines of text into it, especially if you include that same text in your question body.

댓글을 달려면 로그인하십시오.

답변 (4개)

Geoff Hayes
Geoff Hayes 2014년 8월 27일
편집: Geoff Hayes 2014년 8월 27일
Rizwan - what is G2mat? Is that a custom function that you wrote? Try using reshape instead
gAsMtx = reshape(G,5,3);

Azzi Abdelmalek
Azzi Abdelmalek 2014년 8월 27일
G2mat is not a Matlab Built-in function

Cute Doll
Cute Doll 2014년 8월 27일
Dear Geoff Hayes & Azzi Abdelmalek, thanks for concern...
It is like this
vec = [1 2 3 4 5]; [mat,padded] = vec2mat(vec,3)
if i run this thing in the command window it works but same thing is not working in above mentioned case (in my 1st question for G)... why?
  댓글 수: 1
Geoff Hayes
Geoff Hayes 2014년 8월 27일
vec2mat is the name of the function. It has nothing to do with the name of the variable being vec. So in your case, you would just type
[gAsMtx,padded] = vec2mat(G,3);
The name of the function does not change.

댓글을 달려면 로그인하십시오.


Cute Doll
Cute Doll 2014년 8월 27일
Dear Geoff Hayes thanks a lot this command works
gAsMtx = reshape(G,5,3);
Stay bless

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by