Extracting data from matrix row vector
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
I have a double Streams with some process I have got vector F which has a value Now I want to go back to the Streams and locate value matching value of F; get 100 columns forward and collect all the data between those two columns. I tried with ismember to locate the position of F in Streams but no success
Data=Streams(J: (J-2544))%does not work
採用された回答
Star Strider
2016 年 1 月 21 日
MATLAB by default increments using the colon ‘:’ operator. If you want it to decrement, you have to tell it specifically to use a negative step.
See if this does what you want:
Data=Streams(J : -1 : (J-2544));
Notice the ‘-1’ step.
8 件のコメント
I got a warning for code X=Streams(J: -1 : (J-2544));
Warning: Integer operands are required for colon operator when used as index
Star Strider
2016 年 1 月 21 日
Well, -1 is an integer, so it’s not the problem.
What is ‘J’? It must also be an integer, and greater than 2544.
J is very small value 3.4514e-04
Star Strider
2016 年 1 月 21 日
That is not going to work as you have written it. First, ‘J’ is a floating-point value, and second, it will generate negative indices the way you have written your array reference. Array indices must be integers greater than zero. ‘J’ must be an integer greater than 2544.
Sag
2016 年 1 月 22 日
Yes I could not get the code running. As a solution, I created another vector 22544 columns before J and named as P. Then I started data analysis 2544 columns after P.
J = min(abs(Time - P(1))) Final=Streams(J: +1 : (J+2544));
Star Strider
2016 年 1 月 22 日
Is your problem solved now?
Sag
2016 年 1 月 22 日
Still there is Warning: Integer operands are required for colon operator when used as index for code Final=Streams(J: +1 : (J+2544)); But the data looks okay Just wanted to know that would above warning affect the data analysis.. Thanks!
Star Strider
2016 年 1 月 22 日
If you cannot address your data arrays correctly, it could affect your data analysis.
‘J’ still needs to be an integer to create your subscript vector.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
