Converting 1x1 matrix into 200x1 with same value?

Hello, I am creating GUI where I want user to put inputs. The input value will be as single number. Say 500.
My code is time dependent. Which means it is having loops which goes till 200 seconds. And calculates value at every second.
So I want to get single input from user and convert it into 200x1 matrix form so the code works properly.
Can anyone suggest me anything?

 Respuesta aceptada

James Tursa
James Tursa el 23 de Abr. de 2015
myVector(1:200,1) = singleValue;

5 comentarios

adi kul
adi kul el 23 de Abr. de 2015
I am not getting it. Can you give it with example?
Suppose:
My function name is Temp. And user given value as 500
So in workspace Temp is 1x1 with value 500.
Now how to use your code according to this function?
Stephen23
Stephen23 el 23 de Abr. de 2015
Editada: Stephen23 el 23 de Abr. de 2015
@adi kul: if this is confusing for you then you need to learn the basics of MATLAB. These tutorials are a good start:
adi kul
adi kul el 23 de Abr. de 2015
@Stephen Cobeldick I do agree. But your comment is not helping me. Instead of sarcasm it will be great if you can explain me his answer.
If I was good at Matlab I would have never come here to ask this "basic" questions!
Stephen23
Stephen23 el 23 de Abr. de 2015
Editada: Stephen23 el 23 de Abr. de 2015
I apologize that you felt that I was being sarcastic, but actually we often provide links for people to learn new things, and those tutorials happen to be an excellent resource for beginners. Please consider doing them.
You comment and further question "Now how to use your code...?" could be used something a bit like this:
>> Temp = 500;
>> myVector(1:200,1) = Temp;
You might like to read about indexing to know a bit more about how this works.
adi kul
adi kul el 23 de Abr. de 2015
@Stephen Cobeldick Now this helps! Thanks a lot :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 23 de Abr. de 2015

Editada:

el 23 de Abr. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by