Replace elements of a cell

2 views (last 30 days)
rsotam
rsotam on 25 Nov 2015
Answered: Andrei Bobrov on 25 Nov 2015
I wrote the following code:
testcell={'R1(2)' 'R1(1)' 'R1(0)'};
vfinal = cell(4,10);
vfinal(1:3) = testcell
I was expecting that the result was:
vfinal =
'R1(2)' 'R1(1)' 'R1(0)' [] [] [] [] [] [] []
[] [] [] [] [] [] [] [] [] []
[] [] [] [] [] [] [] [] [] []
[] [] [] [] [] [] [] [] [] []
But the result was:
vfinal =
'R1(2)' [] [] [] [] [] [] [] [] []
'R1(1)' [] [] [] [] [] [] [] [] []
'R1(0)' [] [] [] [] [] [] [] [] []
[] [] [] [] [] [] [] [] [] []
Any tips?
Thank you.

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 25 Nov 2015
testcell={'R1(2)' 'R1(1)' 'R1(0)'};
vfinal = cell(4,10);
vfinal(1,1:3) = testcell

More Answers (0)

Categories

Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!