フィルターのクリア

I'm trying to extract position data that brought in from a plot that I made, that is saved as a structure

2 ビュー (過去 30 日間)
MATLAB saves this as a structure variable, I'm trying to extract the x, y position data as vectors. The position field looks like 1,2 for 16 element and I'm trying to sort these out into vectors. I have tried s.f and it gives me both x and y for all values but when I do a = s.f it only gives me the first value?
  2 件のコメント
KSSV
KSSV 2017 年 10 月 6 日
You have not given the code....or your variable...give code so that we can help you.
Jonathan Duncan
Jonathan Duncan 2017 年 10 月 6 日
編集済み: Jonathan Duncan 2017 年 10 月 6 日
cell4_50um(:).Position, I've provided and image of the structure what I'm trying to to is just parse out the chosen position coordinates from my plot into x and y vectors. or at this point just a single vector

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

採用された回答

KSSV
KSSV 2017 年 10 月 6 日
s = struct ;
for i = 1:10
s(i).f = [rand rand] ;
end
k = reshape([s.f],2,[])' ;
  2 件のコメント
Jonathan Duncan
Jonathan Duncan 2017 年 10 月 6 日
It works, I wanted to know for the line, s(i).f = [rand rand] ; what is rand for it looks like something I tried earlier: [x,y] = Position{:} where you can pull out data from the given cells. Is this what is splitting k into the two vectors? Also is there a way to do this in the command window or is this the more optimal way by your suggestion.
KSSV
KSSV 2017 年 10 月 6 日
I am trying to make a structure with random data for demonstration.... rand gives a random number.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by