MATLAB Answers

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

3 views (last 30 days)
Rahul Panchal
Rahul Panchal on 18 Apr 2016
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 ?


Show 1 older comment
Rahul Panchal
Rahul Panchal on 18 Apr 2016
one row but 17 singe cell columns like R1 R2 R3 ...R17 or one single columns with 17 rows like R1 R2 R3

Sign in to comment.

Answers (1)

Muhammad Usman  Saleem
Muhammad Usman Saleem on 18 Apr 2016
Edited: Muhammad Usman Saleem on 19 Apr 2016
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 =
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 =
0.9134 0.6324 0.0975
0.1419 0.4218 0.9157
0.7922 0.9595 0.6557


Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by