Re: How to get vector elements to be interpreted as comma-separated arguments to a function?
- From: "us " <us@xxxxxxxxxxxxxxx>
- Date: Wed, 9 Apr 2008 22:04:03 +0000 (UTC)
"Joel Dedrick":
<SNIP ML basics...
x = {3, 7, 1, 8}
x = {3, ':', 1, 8}
works, but only with the single quotes around the colon
x = {3, 'end', 1, 8}
fails, with or without single quotes
x = {3, 2:4, 1, 8}
fails, with or without single quotes
of course...
these should read
x={3,7,1,8}; % <- note: size(x) is 1x4
x{[2,end]}
% ans = 7
% ans = 8
x{[1,end:-1:2]}
% ans = 3
% ans = 8
% ans = 1
% ans = 7
% -but-
x{[1,end:-1:2],1}
% ans = 3 <- find out WHY!
us
.
- References:
- How to get vector elements to be interpreted as comma-separated arguments to a function?
- From: Joel Dedrick
- Re: How to get vector elements to be interpreted as comma-separated arguments to a function?
- From: helper
- Re: How to get vector elements to be interpreted as comma-separated arguments to a function?
- From: Joel Dedrick
- How to get vector elements to be interpreted as comma-separated arguments to a function?
- Prev by Date: Re: read/write binaries with exclusive access?
- Next by Date: Re: Wavelet doubts
- Previous by thread: Re: How to get vector elements to be interpreted as comma-separated arguments to a function?
- Next by thread: Re: fmincon problem
- Index(es):
Relevant Pages
|