How can I print the output data in different way?

Hi,
I have a simple equation as below
"
[x,y] = meshgrid(-5: 4: 5, -5: 4: 5);
x1 = -1;
y1 = 0;
V_x1 = ((y-y1)./((x-x1).^2+(y-y1).^2)) "
It does give the output as below
"
V_x1 =
-0.1220 -0.2000 -0.1220
-0.0588 -1.0000 -0.0588
0.1200 0.3333 0.1200
"
Does anyone know how can I have them like
"
V_x1 =
-0.1220 -0.2000 -0.1220 -0.0588 -1.0000 -0.0588 0.1200 0.3333 0.1200
"
To be in one row or column.
Thanks in advance.

 채택된 답변

Star Strider
Star Strider 2014년 4월 30일

0 개 추천

Another way:
V_x1 = V_x1(:)

댓글 수: 2

JMS
JMS 2014년 5월 1일
Thanks. And how do I save the output data into a '*.txt' file?
My pleasure!
See the documentation for the save function, specifically under Examples, ‘Save Data to ASCII File’.

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

추가 답변 (1개)

Sara
Sara 2014년 4월 30일

0 개 추천

V_x1 = reshape(V_x1',1,[])

카테고리

질문:

JMS
2014년 4월 30일

댓글:

2014년 5월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by