intercalar03

Version 1.0.0.0 (1019 Bytes) by Miguel D. B.
Intercalates the elements of 2 or more vectors to form one row vector
1.4K Downloads
Updated 13 Mar 2006

No License

This file contains a simple function of the form:
[TT,T]=intercalar03(A,B,C,...)

Where if

A=[a1 a2...an]; B=[b1 b2...bn];
c=[c1 c2...cn]

Then TT=[a1 b1 c1 a2 b2 c2...an bn cn]

It also works if any of B,C,D... is an escalar. Thus, if C is an escalar c, then C=[c c c...c] is taken to have the same number of elements A has.
Not only it works with numbers, but with any kind of variable that accepts a simple array manipulation. (i.e. char or sym, but not inline objects)

The idea is simple, and many others might have used that before:

1. Create the matrix T=[A; B; C;...]
2. Read it's columns as T(:).'

Usage: I have used it to generate discontinuous plots by intercalating the coordinates with Nan. The file includes an example of this.
Note: I was not capable of avoiding the loop to create the matrix TT, since there is a variable number of input arguments. How can that be done?

Cite As

Miguel D. B. (2024). intercalar03 (https://www.mathworks.com/matlabcentral/fileexchange/10323-intercalar03), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R11
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0