i am executing a piece of code given below in which i am getting the error"Unexpected MATLAB expression" help me to solve it

rc = D S
0.0012 0.0001
0.0105 0.0010
0.0705 0.0070
0.2373 0.0340
0.6196 0.1123
1.5142 0.3193
2.8189 0.7740
4.0687 1.4638

Answers (1)

What is your intent? This doesn't honor Matlab syntax rules.
Minimal changes are needed to create a cell array
rc = { 'D' 'S'
0.0012 0.0001
0.0105 0.0010
0.0705 0.0070
0.2373 0.0340
0.6196 0.1123
1.5142 0.3193
2.8189 0.7740
4.0687 1.4638 };
and with a little more editing one can create a table
val = [ 0.0012 0.0001
0.0105 0.0010
0.0705 0.0070
0.2373 0.0340
0.6196 0.1123
1.5142 0.3193
2.8189 0.7740
4.0687 1.4638 ];
D = val(:,1);
S = val(:,2);
rc = table( D, S )
which outputs
rc =
D S
______ ______
0.0012 0.0001
0.0105 0.001
0.0705 0.007
0.2373 0.034
0.6196 0.1123
1.5142 0.3193
2.8189 0.774
4.0687 1.4638

This question is closed.

Asked:

on 4 Mar 2015

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!