Exchange data from Workspace struct

1 回表示 (過去 30 日間)
Jelthe
Jelthe 2016 年 4 月 14 日
コメント済み: Jelthe 2016 年 4 月 21 日
Hello,
I want to exchange data from a Workspace struct with my own data. Sounds easy but: MY data (lets call it y) y is a 700x1 double. The data x from the struct is 9000 times 700x1 double. So how can i tell matlab to get in to the struct and exchange every 9000 x with my y. I hope you did understand my question.
I attached an image so you can see i want to do.
thanks.

採用された回答

Guillaume
Guillaume 2016 年 4 月 14 日
編集済み: Guillaume 2016 年 4 月 14 日
This is one of the rare case where deal is useful:
[data.data] = deal(y);
Note that your structure is called data and so is the field of the structure. Please come up with some more meaningful names.
I have to ask, what is the point of storing 9599 times the same data?
  2 件のコメント
Jelthe
Jelthe 2016 年 4 月 14 日
WOW. just .. i was thinking of something like a for or while loop and a really long code. Thanks worked and didnt even take like 2 seconds to copy and compute. That saved me a whole lot of work. Thanks mate.
Jelthe
Jelthe 2016 年 4 月 21 日
ahh yes. if you´re still interested in why i stroe 9000 times the same data. i wanted to make an own ideal spectra of gaussiancurves. Cuz of second order correlation you need like 10000 spectra to calculate pulse duration out of it. Now i have another question for you. I am still working with deal. but thats the bottleneck of my code. its slows me down really hard. I have to copy a matrix of 700x9000 data points into a struct, as seen in the picture. Do you have any ideas how to speed that up?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by