Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
matlab c# programming

Subject: matlab c# programming

From: Fei

Date: 11 Apr, 2013 07:30:14

Message: 1 of 2

Hi,

I used matlab to call the c# interface to retrieve some data as below:

price = histData.getTickData(...);

price is a list of c# object, which ecapsulates the price info such as price, volume, turnover.
I use the below loop to extract the price and convert into matlab matrix

matlab_price = nan(price.Length, 8);
for i=1:price.Length
    matlab_price(i,1) = price(1).time;
    matlab_price(i,2) = price(1).volume;
    ...
    matlab_price(i,8) = price(1).turnover;
end

The above loop and the 8 assignments were very slow, which took around 0.2s to finish compared to a total of 0.22 execution time.
As the price is a c# object, there is no way to use the vector-grammer such as
matlab_price(:, 1) = [price.time];
matlab_price(:, 2) = [price.volume];
..
Any idea how to improve the "assigment" performance?

Thanks in advance

Subject: matlab c# programming

From: Yair Altman

Date: 20 Apr, 2013 17:48:09

Message: 2 of 2

Cross reference:
http://www.mathworks.com/matlabcentral/answers/72668-matlab-csharp-programming-performance


Yair Altman
http://UndocumentedMatlab.com
 

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us