How to make MATLAB compute values in vertical columns to copy easier?

조회 수: 8 (최근 30일)
Hello all! I am very new to MATLAB and was hoping somebody could help me with something small. I have been researching how to do this, however, I cannot figure it out.. I have created a program used to calculate projectile motion when considering drag. I need MATLAB to give me the y values in a neat column-like way so I can copy them and paste them into my excel spreadsheet for easier handling. Any help would be appreciated! I have attached images of my MATLAB output as well as my excel spreadsheet set up so you can understand what I am trying to do. I cannot easily copy my MATLAB output and paste it into excel currently.

채택된 답변

Star Strider
Star Strider 2022년 3월 2일
Using the ‘(:)’ subscript convention, each variable will be forced to be a column vector regardless of its original orientation:
x = randn(1,10)
x = 1×10
2.1800 1.3616 2.5359 1.0886 -1.7301 -0.2944 1.3354 1.0003 -0.0779 -0.5845
y = randn(10,1)
y = 10×1
-1.2733 -2.5885 -0.3990 0.1731 -1.3933 -1.4434 0.8243 0.4299 0.5031 -0.0946
xc = x(:) % Force Column Orientation
xc = 10×1
2.1800 1.3616 2.5359 1.0886 -1.7301 -0.2944 1.3354 1.0003 -0.0779 -0.5845
yc = y(:) % Force Column Orientation
yc = 10×1
-1.2733 -2.5885 -0.3990 0.1731 -1.3933 -1.4434 0.8243 0.4299 0.5031 -0.0946
.

추가 답변 (1개)

Arif Hoq
Arif Hoq 2022년 3월 2일
편집: Arif Hoq 2022년 3월 2일
may be you want to transpose "y". end of your code type this syntax
output=y';

카테고리

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

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by