Transpose vector or array

Hello

I want to Transpose sine-wave data in c-script, the sine-wave equation is:

X = 200sin(2pi50t), where t, is Time already defined, usually in matlab used this character ( ’ ) to transpose vector or array. So is that possible to do in plecs c-script

Thanks

Did you consider loading the matrix data in an initialization script, and transposing the time vector there, prior to being passed to the C-Script block as a Parameter?

This is a general C question.

1D C arrays or vectors do not need to be transposed as there is not a distinction between a [1xN] or [Nx1] like in MATLAB/Octave.

If you have a higher order matrix, then you can use for loops and re-indexing. There are plenty of code examples available elsewhere for this.

Note that oftentimes in PLECS C-Scripts, one would not use an array of time values, but rather the CurrentTime macro, which reports the simulation time as a single C double.

once I implement the x equation in matlab, the data inside x is (1 x 2000) by using this character (') the data will become (2000 x 1), I want to do the same in plecs c-script

I need this transpose of 1D array or vector then after to compute another variables

Dear Kris,

the input signal to c-script is sinewave , and i want to transpose from (1 x2000) to (2000 x 1)

please help me with this problem

thanks

Can you post example model files that show what you are trying to do?

Dear Kris

thank you for your reply

I want to transpose the sinewave signal which is the input of C-Script block as shown in the attach model, for more information you can look into matlab code.

Thanks

JA_Model.m (1.53 KB)

Jiles Atherton.plecs (16.2 KB)