Borrar filtros
Borrar filtros

How to fill array of zeros with string

47 visualizaciones (últimos 30 días)
suleiman abdullahi
suleiman abdullahi el 18 de Ag. de 2019
Comentada: suleiman abdullahi el 18 de Ag. de 2019
Hello,
I have the following code in which i want to fill the preallocated x with strings instead of number, i reason like this
x = zeros(5,1);
for k =1:length(x)
x(k) = {'load'};
end
x
but i get this error >> Conversion to double from cell is not possible.
Error in weather (line 60)
x(k) = {'load'};
Your help is much appreciated.

Respuesta aceptada

Bruno Luong
Bruno Luong el 18 de Ag. de 2019
x = cell(5,1);
for k =1:length(x)
x(k) = {'load'};
end

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by