Make a matrix from the string values from textboxes in GUI

Posted on 2009-05-05
Last Modified: 2013-11-25
I retrieve several values from different textboxes in my GUI, and each textbox contains a number. I'm trying to make a matrix of these string values. I've tried a few ways to do this, but all I get is this error:

??? Error using ==> vertcat
CAT arguments dimensions are not consistent.

Error in ==> gui_gettable at 78
Q =[QTBox1 QTBox2 QTBox3 QTBox4 QTBox5 QTBox6 QTBox7 QTBox8

How can I make a valid matrix from the string value in the textboxes?
QTBox1 = get(handles.txtQTBox1, 'String');

QTBox2 = get(handles.txtQTBox2, 'String');

QTBox3 = get(handles.txtQTBox3, 'String');

QTBox4 = get(handles.txtQTBox4, 'String');

QTBox5 = get(handles.txtQTBox5, 'String');

QTBox6 = get(handles.txtQTBox6, 'String');

QTBox7 = get(handles.txtQTBox7, 'String');

QTBox8 = get(handles.txtQTBox8, 'String');

QTBox9 = get(handles.txtQTBox9, 'String');

QTBox10 = get(handles.txtQTBox10, 'String');

QTBox11 = get(handles.txtQTBox11, 'String');

QTBox12 = get(handles.txtQTBox12, 'String');

QTBox13 = get(handles.txtQTBox13, 'String');

QTBox14 = get(handles.txtQTBox14, 'String');

QTBox15 = get(handles.txtQTBox15, 'String');

QTBox16 = get(handles.txtQTBox16, 'String');

Q = [QTBox1 QTBox2 QTBox3 QTBox4 QTBox5 QTBox6 QTBox7 QTBox8

    QTBox9 QTBox10 QTBox11 QTBox12 QTBox13 QTBox14 QTBox15 QTBox16];

Q = str2num(Q);

Open in new window

Question by:Buginator
LVL 15

Accepted Solution

yuk99 earned 500 total points
ID: 24304421
You have to do str2num before concatenation for each element separately.

Author Closing Comment

ID: 31577972
Simple as that. Thanks.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
python pyusb how to find a file on mass storage 3 81
sameEnds challenge 25 83
Problem to start Neon 20 85
Re-position the objects 7 96
If you haven’t already, I encourage you to read the first article ( in my series to gain a basic foundation of R and R Studio.  You will also find the …
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now