How to store R Square values in seperate matrix from different regression ?

2 次查看(过去 30 天)
Hi,
I am plotting 17 different regression plots. So, I have 17 different 17 R_square values. Now I want to store R_Square values in the matrix - 1 row , 17 columns or vice a versa.
Currently I tried following R1 = num2str(STATS(1),3), so on up to 17 R Square values then try to create array or matrix as below
[xR] = [R1 R2 R 3.......R17] save ' xR.mat' xR but this stores as "ans" not as array I tried xR = {R1, R2, R3, ....R17} --- it creates the array but does not create the matrix. --- I may add more regression plots so instead of putting R Square values in array manually. I would like to use loop or if command to store the R_Square values in matrix.
is there any good way to store these R_Square values using loop or if ?
  4 个评论
Rahul Panchal
Rahul Panchal 2016-4-18
one row but 17 singe cell columns like R1 R2 R3 ...R17 or one single columns with 17 rows like R1 R2 R3

请先登录,再进行评论。

回答(1 个)

Muhammad Usman Saleem
编辑:Muhammad Usman Saleem 2016-4-19
For single row and 17 column, try this one
xR = [R1; R2; R3;R4;R5;....;R17] ;
This create a matrix 1*17.
What is nature of R1? whether it is vector or some scaler?
According to my understanding of your kind question, You are looking something like this
R1=rand(1,3) %random vector order(1,3)
R1 =
0.9134 0.6324 0.0975
R2=rand(1,3)
R2 =
0.1419 0.4218 0.9157
>> R3=rand(1,3)
R3 =
0.7922 0.9595 0.6557
Now making a matrix of R1,R2,R3
xR=[R1;R2;R3]
xR =
0.9134 0.6324 0.0975
0.1419 0.4218 0.9157
0.7922 0.9595 0.6557

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by