Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
MATALB HELP! Assigning arrays from the workspace to different columns of the data table!

Subject: MATALB HELP! Assigning arrays from the workspace to different columns of the data table!

From: Sam Yang

Date: 11 Jun, 2011 15:11:05

Message: 1 of 3

Hello! I am trying to assign arrays of multiple integers (increase by row) to different columns of my data table. I tried to use the following code to call the arrays from the workspace and assign each array to different columns as the row keeps incrementing. However, I get an error stating a dimension mismatch. I know I am missing someting very important here but I do not know what! PLEASE HELP AND THANK YOU IN ADVANCE!

        %Call arrays from the workspace
        result(handles.n,1) = evalin('base','Frequency');
        result(handles.n,2) = evalin('base','Speed');
        result(handles.n,3) = evalin('base','Torque');
        result(handles.n,4) = evalin('base','Input_Power');
        result(handles.n,5) = evalin('base','Output_Power');
        result(handles.n,6) = evalin('base','Efficiency');
        %Assign the matrix to the workspace
        assignin('base', 'Results');

Subject: MATALB HELP! Assigning arrays from the workspace to different columns of the data table!

From: Sadik

Date: 11 Jun, 2011 18:07:02

Message: 2 of 3

Hi Sam,

1. You should check if Frequency, Speed, ..., Efficiency are all the same length.

2. You should use colon as in

result(:,1) = evalin('base','Frequency');

to assign frequency to your first column. Similar for the others.

3. Variable names are case-sensitive. You should use: assignin('base', 'result');

Best.

Subject: MATALB HELP! Assigning arrays from the workspace to different columns of the data table!

From: Sam Yang

Date: 11 Jun, 2011 21:19:05

Message: 3 of 3

THANK YOU VERY MUCH! IT WORKS PERFECTLY NOW!


"Sadik " <sadik.hava@gmail.com> wrote in message <it0as6$seu$1@newscl01ah.mathworks.com>...
> Hi Sam,
>
> 1. You should check if Frequency, Speed, ..., Efficiency are all the same length.
>
> 2. You should use colon as in
>
> result(:,1) = evalin('base','Frequency');
>
> to assign frequency to your first column. Similar for the others.
>
> 3. Variable names are case-sensitive. You should use: assignin('base', 'result');
>
> Best.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us