How to read cell range from one cell in file

3 次查看(过去 30 天)
Hi all
I want to read cell range from a file. Each cell of this file contains a different cell range. For example raw is the file and raw(2,3) = 3:4, 6:10
So I want X(raw{2,3}) which is the same as X(3:4,6:10) but when I run it they are not the same. Each one gives different result. Any idea how I can fix it?
  2 个评论
Iman Ansari
Iman Ansari 2013-5-6
X(raw{2,3})====X([3 4 6 7 8 9 10])
X(3:4,6:10)====X([3,4],[6 7 8 9 10])
Diana
Diana 2013-5-6
Can you explains to me why raw{2,3} = 3:4,6:10 but X(raw{2,3}==X([3 4 6 7 8 9 10]) ?

请先登录,再进行评论。

回答(2 个)

Andrei Bobrov
Andrei Bobrov 2013-5-6
raw(2,3) = {3:4, 6:10};
  5 个评论
Andrei Bobrov
Andrei Bobrov 2013-5-6
raw = cell(3);
raw{2,3} = {3:4,6:10};
X = randi(18,10); eg
X(raw{2,3}{:})
Diana
Diana 2013-5-13
Using this show an error: Cell contents reference from a non-cell array object.
The cell i AM TRYING TO EXPORT CONTAINS CHARACTERS LIKE '3:6, 7:8'
Any idea how I could fix it?

请先登录,再进行评论。


Yao Li
Yao Li 2013-5-13
Try
raw{2,3}={3:4,6:10};
x=rand(10,10);
x(3:4,6:10)
x(raw{2,3}{1,1},raw{2,3}{1,2})

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by