| Thread Closed |
MATLAB save command and transpose command |
Share Thread | Thread Tools |
| Apr30-09, 06:56 PM | #1 |
|
|
MATLAB save command and transpose command
I have a bunch of row vectors saved as objects r1 r2 r3. I would like to send each set of data (row) to a text file, but I want it to save as a column. This means that I want to save the transpose of the data, i.e., r1' r2'...
Unfortunately, when I try to use Code:
save r1.txt r1' -ascii I know that an "easy fix" would be to create new objects like R1=r1'; but I don't really think that is efficient. How can I get around this? thanks Casey |
| May5-09, 12:49 AM | #2 |
|
|
any takers on this one?
|
| May5-09, 01:44 AM | #3 |
|
|
save(<string (filename)>, <string (variable name 1)>, ... <string (variable name N)>, <string (options)>) You are not passing the function actual variables, just the names. That's why you can't pass r1', because that is not a string. Why is, r1 = r1'; save('rrrrrs.txt', 'r1', '-ascii'); not efficient? I mean, the transpose has to be done somewhere in memory. |
| May5-09, 10:57 AM | #4 |
|
|
MATLAB save command and transpose commandI suppose I could write a for loop that does it for me, but for only 10 entries, that seemed a little tedious (possibly just laziness ).
|
| May5-09, 01:08 PM | #5 |
|
|
lol, yeah.
You could probably write a wrapper around the save function, to do what you want. function tSave(V) vt = V'; save([num2str(V) '.txt'], 'vt', '-ascii'); end then just call this little function instead |
| Thread Closed |
| Thread Tools | |
Similar Threads for: MATLAB save command and transpose command
|
||||
| Thread | Forum | Replies | ||
| matlab command "while" | Engineering, Comp Sci, & Technology Homework | 4 | ||
| while command in MATLAB | Math & Science Software | 4 | ||
| MATLAB 'syms' command | Math & Science Software | 0 | ||
| Symbolic intergration in Matlab using "INT" command? | Math & Science Software | 3 | ||
| making functions with 'inline' command in matlab | Math & Science Software | 1 | ||