Copy data from Excel Column and Paste in Matlab Row

Hi everyone,
I'd like to copy a column with a bunch of values from excel and paste it into a row in matlab. Whenever I paste, the values are pasted in a column. How can I paste it in the row instead? I've seen the option to transpose the data, but that works only with the first set of data, as the transposition of subsequent data will be transposed altogether.
Any help is greatly aprecciated! Thank you.

5 Comments

You mean manually copy and paste? Where is the target of the paste operation -- I've never much had any call to do that other than perhaps picking pieces out of the forum here to paste into the command window; trying to figure out what you're trying to do that wouldn't be more easily accomplished programmatically.
Yes, manually copy and paste. They are from many different documents, so I think it's kind of difficult to do it automatically.
dpb
dpb on 4 Sep 2022
Edited: dpb on 4 Sep 2022
That's all the more reason to automate -- don't they at least have something in common like a sequential name or other way to identify them? And, if pasting the data together, it would seem the content must be at least similar...do you need to do this more than this one-time exercise or is this a repeating event in your workflow?
But, as to the Q? itself...why not just operate on column-oriented array instead? Almost all MATLAB builtin functions are vectorized to treat columns as separate variables/observations; MATLAB storage order is by column; seems as though that would be the natural way to operate.
Or, if the data indeed were stored in the wrong order in the original workbooks and the rows therein really are what should be columns as above, then do all the copy/paste operations first, then transpose and do the analyses.
dpb
dpb on 4 Sep 2022
Edited: dpb on 4 Sep 2022
I still don't know where you're pasting stuff into MATLAB?
Being older than dirt, I've never used any of the newfangled GUI interface stuff, I operate from the command line or write code; I guess the what do they call it -- the variable editor??? maybe can work sorta' like a klunky spreadsheet, maybe is what your're trying to use???
<poke, poke, ...>
Yeah, guess that must be it -- if open "New variable" I can see a RB click menu that seems to match up with what you describe. Looks like TMW hasn't finished their job; there should be an option on Paste to transpose the pasted data when doing so, but appears not to be implemented.
Looks like if you're determined to play at the keyboard only you're stuck...best plan of attack unless this is a "one-time-only" exercise still appears to me to be to write a script/function instead -- you can make the file selection somewhat less cumbersome for user by using the GUI filepicker in multi-select mode (if at least the files are in one folder).
Failing that, go ahead and paste all the data first, then transpose the results.
Hi, yes I mean the variable editor. Paste the transposed data is possible in Excel, so now I transpose the data in Excel, copy it there and then paste it into Matlab ^.^. This is currently a one-time-only exercise, but might need to be a workflow that needs to be established in a few days, we'll see... Anyway, thank you for your help!

Sign in to comment.

Answers (0)

Products

Release

R2021b

Asked:

on 4 Sep 2022

Commented:

on 4 Sep 2022

Community Treasure Hunt

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

Start Hunting!