How to use indexing to identify data in data(1, :) from points identifed in data(2,:)?

6 次查看(过去 30 天)
Hi all,
I have a 2x17205 array (called vas_med_env; attached).
in vas_med_env(2,:) I have identified :
j= [5.8150 6.8350 7.8550 8.850]
Now I want to use j, to ''extract' data in vas_med_env(1,:) , by using indexing
my approach below:
n = length(j)-1;
vas_med_cycle = cell(n,1) ;
for i = 1:n
vas_med_cycle{i} = (vas_med_env(1, :),(vas_med_env(2, :),j(i):j(i+1))) ;
end
results in
vas_med_cycle{i} = (vas_med_env(1, :),(vas_med_env(2, :),j(i):j(i+1))) ;
Error: Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check
for mismatched delimiters.
Can you help please?

采纳的回答

Walter Roberson
Walter Roberson 2022-5-21
You have a right-hand side expression of the form
(A, (B, C))
That has no meaning in MATLAB.
MATLAB does not define any way to create "tuples". That expression would not create a tuple in which the first element is A and the second element is a tuple in which the first element is B and the second element is C.
Perhaps you meant
vas_med_cycle{i} = {vas_med_env(1, :), {vas_med_env(2, :),j(i):j(i+1)}} ;
or perhaps you meant
vas_med_cycle{i} = [vas_med_env(1, :), vas_med_env(2, :), j(i):j(i+1)] ;
  4 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by