Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Vector dimensions and variable display

조회 수: 1 (최근 30일)
Chet Sharma
Chet Sharma 2018년 2월 14일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi This is a question about how Matlab displays certain variables, depending on the number of dimensions contained. When I generate randn(10,2), I get a 10X2 table in the workspace window, very easy to copy paste directly from here to excel. However, when I do randn(10,2,1), Matlab creates something that looks like a text file in the workspace. Copying the data over can be a pain when you have randn(1000,2,1) for example. Why does Matlab do this?
For context - I want to "pre-generate" (if there's such a word) a set of random numbers for multiple assets and for multiple simulations; hence I'm using randn(NumSteps,NumAssets,NumSimulations). Thanks C
  댓글 수: 1
Stephen23
Stephen23 2018년 2월 14일
편집: Stephen23 2018년 2월 14일
Instead of copy-and-pasting, why not just get MATLAB to write the Excel file for you?
"Copying the data over can be a pain when you have randn(1000,2,1) for example. Why does Matlab do this?"
Because data is reliably written to files and read from files using the appropriate functions. Copy-and-pasting is not a reliable method for transferring data between files/programs/applications/...

답변 (1개)

Chet Sharma
Chet Sharma 2018년 2월 16일
Thanks sir - coming around to that way of thinking.....and going to implement that.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by