How to read cell range from one cell in file

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 Kommentare

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 am 6 Mai 2013
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]) ?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Andrei Bobrov
Andrei Bobrov am 6 Mai 2013

0 Stimmen

raw(2,3) = {3:4, 6:10};

5 Kommentare

Diana
Diana am 6 Mai 2013
X(raw(2,3)) doesn't work as well. It does not give me same result as X(3:4,6:10).
How could I get same result using index to my file raw? (so I don't have to type the cell range..)
raw(2,3) = {3:4, 6:10};
X(raw{2,3})
Diana
Diana am 6 Mai 2013
X(raw{2,3}) is not giving the same result as X(3:4, 6:10).
raw = cell(3);
raw{2,3} = {3:4,6:10};
X = randi(18,10); eg
X(raw{2,3}{:})
Diana
Diana am 13 Mai 2013
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?

Melden Sie sich an, um zu kommentieren.

Yao Li
Yao Li am 13 Mai 2013

0 Stimmen

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})

1 Kommentar

Diana
Diana am 17 Mai 2013
Now it is returning:Cell contents reference from a non-cell array object.

Melden Sie sich an, um zu kommentieren.

Kategorien

Gefragt:

am 6 Mai 2013

Community Treasure Hunt

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

Start Hunting!

Translated by