Convert matrix into structure array

Hello everyone,
I am trying to execute a code but it requires data matrix (605x1006x3) to be structure array. How can I convert the matrix into structure array? Here is how the data looks like.
Thanks in advance, Igor

7 Kommentare

James Tursa
James Tursa am 10 Jan. 2017
Bearbeitet: James Tursa am 10 Jan. 2017
Please post the relevant portions of the code you are using. If you are getting an error message, copy & paste the entire error message (including the offending line of code) for us to see.
Walter Roberson
Walter Roberson am 11 Jan. 2017
How does your 605x1006x3 correspond to the structure array? Does each row correspond to a structure member? Should the columns for each row be broken up between the 9 fields, and if so in what proportion?
I can see how the data in the structure could potentially be reorganized as a 2D array, but I do not see anything there that might correspond to the third dimension ? With the x 3 final dimension that is suggestive that you have an image as input; I do not see anything in the structure array that looks like it might correspond to an image.
Igor Jovanovic
Igor Jovanovic am 11 Jan. 2017
Bearbeitet: Igor Jovanovic am 11 Jan. 2017
Hello,
James, thank you for your comment. James, the original code is attached. (period_1_allstocks.m) The exact error I get is the following.
period_1_allstocks
Error using rmfield (line 17)
S must be a structure array.
Error in period_1_allstocks (line 4)
cdata=rmfield(cdata, redundant);
This is basically the script which can be found here. http://nl.mathworks.com/matlabcentral/fileexchange/59541-pairs-trading-strategy-ggr--2006- The data we are going to use can be found below. We have to customize the script in order to analyze the data. Columns are individual stocks and rows are daily prices of differet stocks. http://www.filedropper.com/pricesraw
Walter, thank you for your comment. I am trying to convert it to the structure array because code error requires so in order to run the code. I am writing the research projects with my colleagues and we should test the findings of this code but for different data set - European stocks. We still cannot run the code with default CRSP data which is in an image format and from here I can conclude that our testing of the code on European stocks if far away.
Every help would be greatly appreciated. We did not have Matlab courses and our supervisor gives us almost no guidance, so we are trying to learn as we go.
Thanks once again.
Best, Igor
Walter Roberson
Walter Roberson am 12 Jan. 2017
Can you attach the dataset you are using for the European stocks (the CRSP data) ?
Igor Jovanovic
Igor Jovanovic am 12 Jan. 2017
Hello,
Thank you on your comment Walter. The script was originally made for CRSP data which contains the U.S. stocks and the download file is below. It is and image format. http://www.filedropper.com/rawdata
I am trying to make the script work with the European stocks. The download file of the data is below. http://www.filedropper.com/pricesraw
Thanks, Igor
Walter Roberson
Walter Roberson am 12 Jan. 2017
That pricesraw file has 4000 rows of 600 columns, but no headers. I cannot tell what each column corresponds to.
Igor Jovanovic
Igor Jovanovic am 12 Jan. 2017
Hi Walter,
Thanks for helping me. Columns are individual stocks[600 stocks] and rows are the dates. It is basically data panel with 600 stock returns over seventeen year period. I hope that it clarifies the data.
Thanks, Igor

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Gefragt:

am 10 Jan. 2017

Kommentiert:

am 12 Jan. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by