using a cell array

Hi,
My problem - I've created a script that works in one computer. I've copied it to three other computers. I also copied the excel and bmp files used in the script, but not shown below. On the other three computers I get the same error message. the right hand side of this assignment has too few values to satisfy the left hand side and it points to the script below.
the relevant part of the script follows
[number1, trainingwordd] = xlsread('trainingword.xls', 'A1:B1')
trainingword = cell(1,1)
trainingword = trainingwordd{1,1}
number1 = double(number1);
otherstuff
trainlearnedorder{1:25,1} = trainingword;
the error message occurs here and points to the above line.
I've checked and trainingword = a sequence of letters as it is supposed to.
Any suggestions would be appreciated. I'm using Matlab 7.11.0 (2010b) on all four computers. I copied the script from the computer I developed it on to the other computers.
Thanks for your help.
Jim

1 Kommentar

Matt J
Matt J am 26 Nov. 2012
It's not clear why you have this line, if you intend trainingword to be a character string
trainingword = cell(1,1)
In any case, you may as well remove it. It's not accomplishing anything.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Matt J
Matt J am 26 Nov. 2012
Bearbeitet: Matt J am 26 Nov. 2012

0 Stimmen

I think you intend this
[trainlearnedorder{1:25,1}] = deal(trainingword);
or this
trainlearnedorder(1:25,1)={trainingword};
How your original code worked on even one of the computers is a mystery to me.

3 Kommentare

Jim
Jim am 26 Nov. 2012
Thanks Matt for taking the time to send suggestions, I tried your first suggestion and received the following error message "Conversion from double to cell is not possible" I also tried the second suggestion and received the following error message "The following error occurred during the conversion from cell to double Error using ==> double Conversion from cell to double is not possible"
Matt J
Matt J am 26 Nov. 2012
Bearbeitet: Matt J am 26 Nov. 2012
Then there's something you're not telling us about what your data looks like. It works fine for me as the following example shows, assuming that trainingword is indeed a string of characters as you say. I suspect, though, that trainlearnedorder already exists as a non-cell array in your workspace. The solution would be to clear it, if you now want it to be a cell.
>> trainingword='abc'; trainlearnedorder(1:25,1)={trainingword}
trainlearnedorder =
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
'abc'
Jim
Jim am 29 Nov. 2012
You were correct - there was a different problem, a different excel file did not have the string it should have hed.

Melden Sie sich an, um zu kommentieren.

Produkte

Tags

Gefragt:

Jim
am 26 Nov. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by