From variable name to data

조회 수: 3 (최근 30일)
Martin
Martin 2015년 6월 25일
편집: Stephen23 2019년 6월 19일
Hello buddies, I got a problem that has frustrated me for about 10 hours today.
I defined 3 variables with names:
v{:,1:3} = genvarname(['v ' label{1,1:3}])
eval([v{:,1:3} '= data(1:nrRows,1:3);'])
This gives v that contains x1 x2 and x3. Each x's has 100 rows.
My problem is, that I would like, somehow(?), to write something like:
v(:,1) or v(:,2) or v(:,3) to optain all 100 rows, in each v(:,i)..
But if I write e.g. v(:,1) I get this answer: 'x1'.. (I can't convert it to numbers (100 rows with data)).
Im sorry if this is very trivial, - I dont program in Matlab everyday.
Hope to hear from someone, have a good day
best
Mergh

채택된 답변

Walter Roberson
Walter Roberson 2015년 6월 25일

추가 답변 (2개)

Stephen23
Stephen23 2015년 6월 26일
편집: Stephen23 2019년 6월 19일

Martin
Martin 2015년 6월 26일
Thanks for both your answers! I will look at it today from now, and get back when I (hopefully) find a solution

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by