Any suggestions to this algorithm?
2 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I have a big problem with my algorithm. I really don’t know what can I do and so confused? If someone have any suggestion that would extremely helpful.
for counter=1:(end of the struct)
*check condition 1
If *condition 1 is true then
counter plus to check the condition 2
Between conditions 1 & 2 there is not fixed amount of data maybe non, 2 or more.
So I need that counter in this loop too.
4 件のコメント
dpb
2018 年 8 月 24 日
I agree w/ both posters; while I can kinda' get the drift of what you're trying to say, not enough given to really do anything with.
I think showing a (smallish) example of input and then the desired result and how you determined that result will be the only way anybody will be able to help here...
Image Analyst
2018 年 8 月 25 日
Azar's "Answer" moved here since it tries (unsuccessfully) to clarify the original post rather than be an "Answer" to the original post.
Thanks all for your support.
This is part of my data:
I deleted some rows to show 'UserEvent'
I want 'X' & 'Y' data between 'onset' and 'offset' where I have 'L' in the 'EventType'
For example in '#Message: onset_P1_8'
I want a variable struct named 'P1_8' or p(1,8) (I really don't know what kind of variable I need!) and the value for this var is []
Sincerely
回答 (1 件)
Image Analyst
2018 年 8 月 25 日
No, you don't (or shouldn't) want this, even though you, and too many other beginners, think so. It can't be stressed too strongly. See the FAQ: https://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F Just don't do it.
You do NOT want to have a struct variable where the name of that variable is determined by part of a string in the "End" field of your structure. If you don't know what possible strings would be there at run-time when you read in your data then how can you refer to that variable with the unknown name when you're writing the code? You can't. So don't do it.
2 件のコメント
Image Analyst
2018 年 8 月 25 日
"Doesn't work" is not very descriptive. At least attach your "Subject" variable in a .mat file with the paper clip icon in case people want to run your code. And see this link so people can read your code.
参考
カテゴリ
Help Center および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!