Read matrices as cell array from long longitudinal matlab data
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
Assume the following hypothetical Matlab data (as column vectors): for 3 subjects (i=1 to 3) each provides three measurements y1, y2 , y3, over 5 time points (j=1 to 5) or less (unbalanced). The original data set is bigger. so I need to use cell array. I need at the end have Y=cell(3,1), such that, for a subject i, Y{i} is a matrix represents the repeated measures for subject i.
i j y1 y2 y3
1 1 1.0 0.6 0.8
1 2 0.8 0.7 0.2
1 3 1.0 0.7 0.9
1 4 1.0 0.8 0.7
1 5 0.7 0.8 0.9
2 1 0.5 0.7 0.8
2 2 0.4 0.7 0.6
2 3 0.4 0.5 0.8
3 1 0.4 0.5 0.7
3 2 0.5 0.6 0.8
3 3 0.5 0.6 0.8
3 4 0.6 0.6 0.8
So I need them look like
Y{1}=
1.0 0.6 0.8
0.8 0.7 0.2
1.0 0.7 0.9
1.0 0.8 0.7
0.7 0.8 0.9
Y{2}=
0.5 0.7 0.8
0.4 0.7 0.6
0.4 0.5 0.8
Y{3}=
0.4 0.5 0.7
0.5 0.6 0.8
0.5 0.6 0.8
0.6 0.6 0.8
I need also to use i and j to help in indexing
matlab cell-array matrix-indexing
add a comment |
Assume the following hypothetical Matlab data (as column vectors): for 3 subjects (i=1 to 3) each provides three measurements y1, y2 , y3, over 5 time points (j=1 to 5) or less (unbalanced). The original data set is bigger. so I need to use cell array. I need at the end have Y=cell(3,1), such that, for a subject i, Y{i} is a matrix represents the repeated measures for subject i.
i j y1 y2 y3
1 1 1.0 0.6 0.8
1 2 0.8 0.7 0.2
1 3 1.0 0.7 0.9
1 4 1.0 0.8 0.7
1 5 0.7 0.8 0.9
2 1 0.5 0.7 0.8
2 2 0.4 0.7 0.6
2 3 0.4 0.5 0.8
3 1 0.4 0.5 0.7
3 2 0.5 0.6 0.8
3 3 0.5 0.6 0.8
3 4 0.6 0.6 0.8
So I need them look like
Y{1}=
1.0 0.6 0.8
0.8 0.7 0.2
1.0 0.7 0.9
1.0 0.8 0.7
0.7 0.8 0.9
Y{2}=
0.5 0.7 0.8
0.4 0.7 0.6
0.4 0.5 0.8
Y{3}=
0.4 0.5 0.7
0.5 0.6 0.8
0.5 0.6 0.8
0.6 0.6 0.8
I need also to use i and j to help in indexing
matlab cell-array matrix-indexing
The question is not clear. What does the original look like (i.e. what does unbalanced mean)? In what format is it (e.g. text file, Matlab array)? What do you expect as an output? A small example with a few lines of unbalanced input and the expected output will help to understand what you exactly want -- and get a useful answer.
– Brice
Nov 23 '18 at 8:46
Please edit the question, this is not readable in a comment
– Brice
Nov 23 '18 at 9:36
@Brice, I felt it was not readable so I edit the question and tried to clarify. Wish it is clear now. Unbalanced means the matrix of each cell in Y is not of the same size. the first is 5X3, second 3X3 , last is 4X3.
– N. I. ElZayat
Nov 23 '18 at 9:43
add a comment |
Assume the following hypothetical Matlab data (as column vectors): for 3 subjects (i=1 to 3) each provides three measurements y1, y2 , y3, over 5 time points (j=1 to 5) or less (unbalanced). The original data set is bigger. so I need to use cell array. I need at the end have Y=cell(3,1), such that, for a subject i, Y{i} is a matrix represents the repeated measures for subject i.
i j y1 y2 y3
1 1 1.0 0.6 0.8
1 2 0.8 0.7 0.2
1 3 1.0 0.7 0.9
1 4 1.0 0.8 0.7
1 5 0.7 0.8 0.9
2 1 0.5 0.7 0.8
2 2 0.4 0.7 0.6
2 3 0.4 0.5 0.8
3 1 0.4 0.5 0.7
3 2 0.5 0.6 0.8
3 3 0.5 0.6 0.8
3 4 0.6 0.6 0.8
So I need them look like
Y{1}=
1.0 0.6 0.8
0.8 0.7 0.2
1.0 0.7 0.9
1.0 0.8 0.7
0.7 0.8 0.9
Y{2}=
0.5 0.7 0.8
0.4 0.7 0.6
0.4 0.5 0.8
Y{3}=
0.4 0.5 0.7
0.5 0.6 0.8
0.5 0.6 0.8
0.6 0.6 0.8
I need also to use i and j to help in indexing
matlab cell-array matrix-indexing
Assume the following hypothetical Matlab data (as column vectors): for 3 subjects (i=1 to 3) each provides three measurements y1, y2 , y3, over 5 time points (j=1 to 5) or less (unbalanced). The original data set is bigger. so I need to use cell array. I need at the end have Y=cell(3,1), such that, for a subject i, Y{i} is a matrix represents the repeated measures for subject i.
i j y1 y2 y3
1 1 1.0 0.6 0.8
1 2 0.8 0.7 0.2
1 3 1.0 0.7 0.9
1 4 1.0 0.8 0.7
1 5 0.7 0.8 0.9
2 1 0.5 0.7 0.8
2 2 0.4 0.7 0.6
2 3 0.4 0.5 0.8
3 1 0.4 0.5 0.7
3 2 0.5 0.6 0.8
3 3 0.5 0.6 0.8
3 4 0.6 0.6 0.8
So I need them look like
Y{1}=
1.0 0.6 0.8
0.8 0.7 0.2
1.0 0.7 0.9
1.0 0.8 0.7
0.7 0.8 0.9
Y{2}=
0.5 0.7 0.8
0.4 0.7 0.6
0.4 0.5 0.8
Y{3}=
0.4 0.5 0.7
0.5 0.6 0.8
0.5 0.6 0.8
0.6 0.6 0.8
I need also to use i and j to help in indexing
matlab cell-array matrix-indexing
matlab cell-array matrix-indexing
edited Nov 23 '18 at 9:47
N. I. ElZayat
asked Nov 23 '18 at 6:19
N. I. ElZayatN. I. ElZayat
11
11
The question is not clear. What does the original look like (i.e. what does unbalanced mean)? In what format is it (e.g. text file, Matlab array)? What do you expect as an output? A small example with a few lines of unbalanced input and the expected output will help to understand what you exactly want -- and get a useful answer.
– Brice
Nov 23 '18 at 8:46
Please edit the question, this is not readable in a comment
– Brice
Nov 23 '18 at 9:36
@Brice, I felt it was not readable so I edit the question and tried to clarify. Wish it is clear now. Unbalanced means the matrix of each cell in Y is not of the same size. the first is 5X3, second 3X3 , last is 4X3.
– N. I. ElZayat
Nov 23 '18 at 9:43
add a comment |
The question is not clear. What does the original look like (i.e. what does unbalanced mean)? In what format is it (e.g. text file, Matlab array)? What do you expect as an output? A small example with a few lines of unbalanced input and the expected output will help to understand what you exactly want -- and get a useful answer.
– Brice
Nov 23 '18 at 8:46
Please edit the question, this is not readable in a comment
– Brice
Nov 23 '18 at 9:36
@Brice, I felt it was not readable so I edit the question and tried to clarify. Wish it is clear now. Unbalanced means the matrix of each cell in Y is not of the same size. the first is 5X3, second 3X3 , last is 4X3.
– N. I. ElZayat
Nov 23 '18 at 9:43
The question is not clear. What does the original look like (i.e. what does unbalanced mean)? In what format is it (e.g. text file, Matlab array)? What do you expect as an output? A small example with a few lines of unbalanced input and the expected output will help to understand what you exactly want -- and get a useful answer.
– Brice
Nov 23 '18 at 8:46
The question is not clear. What does the original look like (i.e. what does unbalanced mean)? In what format is it (e.g. text file, Matlab array)? What do you expect as an output? A small example with a few lines of unbalanced input and the expected output will help to understand what you exactly want -- and get a useful answer.
– Brice
Nov 23 '18 at 8:46
Please edit the question, this is not readable in a comment
– Brice
Nov 23 '18 at 9:36
Please edit the question, this is not readable in a comment
– Brice
Nov 23 '18 at 9:36
@Brice, I felt it was not readable so I edit the question and tried to clarify. Wish it is clear now. Unbalanced means the matrix of each cell in Y is not of the same size. the first is 5X3, second 3X3 , last is 4X3.
– N. I. ElZayat
Nov 23 '18 at 9:43
@Brice, I felt it was not readable so I edit the question and tried to clarify. Wish it is clear now. Unbalanced means the matrix of each cell in Y is not of the same size. the first is 5X3, second 3X3 , last is 4X3.
– N. I. ElZayat
Nov 23 '18 at 9:43
add a comment |
1 Answer
1
active
oldest
votes
I'll assume that the input data is contained in 5 vectors called i
, j
, y1
, y2
and y3
. You may use the following code:
% Initialize Y
Y = cell(max(i),1);
% Loop to read
for kk=1:max(i)
sel = (i==kk); % Logical array use to select lines according to i
ind = j(sel); % This is in case the input data is not sorted, we'll know where the data has to go in Y{...}
% Start with last column so that Y{ii} is initialized with the good size
Y{kk}(ind,3) = y3(sel);
Y{kk}(ind,2) = y2(sel);
Y{kk}(ind,1) = y1(sel);
end
If all the data is already sorted by i
& j
, you could use mat2cell
. A loop would still be needed to know the number of lines for each value of i
:
% Initialize Y
count = zeros(max(i),1);
% Loop to count
for kk=1:max(i)
count(kk)=(i==kk);
end
Y = mat2cell([y1,y2,y3] , count);
(As a side note, the use of i
and j
as variable names is not recommended as it may lead to a confusion with the imaginary unit i
and may affect performance. Mathworks recommends to use other variable names, and use 1i
or 1j
when referring to the imaginary unit.)
your first code results in an error, I modified two lines then it work but I cant post the code in a neat way in the comment as ctrl+k does not define the selected line as code here
– N. I. ElZayat
Nov 23 '18 at 13:47
You may use backquotes ` around code snippets in comments. This is also how you put code inline in questions & answers.
– Brice
Nov 23 '18 at 14:23
The modified code is //N=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); Y{kk} = [y1(sel),y2(sel),y3(sel)]; end
// I can not find how to enter new line in the comment??
– N. I. ElZayat
Nov 23 '18 at 14:27
And you will not : you can't enter new line in comments...
– Brice
Nov 23 '18 at 14:57
I got it. As regards running the code in my last comment on the full data set I need to add another command line in the loop to get rid of NAN vectors for unbalanced subjects, the final code that works fine with my full data isN=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); yy = [y1(sel),y2(sel),y3(sel)]; yy(any(isnan(yy), 2), :) = ; Y{kk} = yy; end
– N. I. ElZayat
Nov 23 '18 at 15:41
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441497%2fread-matrices-as-cell-array-from-long-longitudinal-matlab-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'll assume that the input data is contained in 5 vectors called i
, j
, y1
, y2
and y3
. You may use the following code:
% Initialize Y
Y = cell(max(i),1);
% Loop to read
for kk=1:max(i)
sel = (i==kk); % Logical array use to select lines according to i
ind = j(sel); % This is in case the input data is not sorted, we'll know where the data has to go in Y{...}
% Start with last column so that Y{ii} is initialized with the good size
Y{kk}(ind,3) = y3(sel);
Y{kk}(ind,2) = y2(sel);
Y{kk}(ind,1) = y1(sel);
end
If all the data is already sorted by i
& j
, you could use mat2cell
. A loop would still be needed to know the number of lines for each value of i
:
% Initialize Y
count = zeros(max(i),1);
% Loop to count
for kk=1:max(i)
count(kk)=(i==kk);
end
Y = mat2cell([y1,y2,y3] , count);
(As a side note, the use of i
and j
as variable names is not recommended as it may lead to a confusion with the imaginary unit i
and may affect performance. Mathworks recommends to use other variable names, and use 1i
or 1j
when referring to the imaginary unit.)
your first code results in an error, I modified two lines then it work but I cant post the code in a neat way in the comment as ctrl+k does not define the selected line as code here
– N. I. ElZayat
Nov 23 '18 at 13:47
You may use backquotes ` around code snippets in comments. This is also how you put code inline in questions & answers.
– Brice
Nov 23 '18 at 14:23
The modified code is //N=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); Y{kk} = [y1(sel),y2(sel),y3(sel)]; end
// I can not find how to enter new line in the comment??
– N. I. ElZayat
Nov 23 '18 at 14:27
And you will not : you can't enter new line in comments...
– Brice
Nov 23 '18 at 14:57
I got it. As regards running the code in my last comment on the full data set I need to add another command line in the loop to get rid of NAN vectors for unbalanced subjects, the final code that works fine with my full data isN=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); yy = [y1(sel),y2(sel),y3(sel)]; yy(any(isnan(yy), 2), :) = ; Y{kk} = yy; end
– N. I. ElZayat
Nov 23 '18 at 15:41
add a comment |
I'll assume that the input data is contained in 5 vectors called i
, j
, y1
, y2
and y3
. You may use the following code:
% Initialize Y
Y = cell(max(i),1);
% Loop to read
for kk=1:max(i)
sel = (i==kk); % Logical array use to select lines according to i
ind = j(sel); % This is in case the input data is not sorted, we'll know where the data has to go in Y{...}
% Start with last column so that Y{ii} is initialized with the good size
Y{kk}(ind,3) = y3(sel);
Y{kk}(ind,2) = y2(sel);
Y{kk}(ind,1) = y1(sel);
end
If all the data is already sorted by i
& j
, you could use mat2cell
. A loop would still be needed to know the number of lines for each value of i
:
% Initialize Y
count = zeros(max(i),1);
% Loop to count
for kk=1:max(i)
count(kk)=(i==kk);
end
Y = mat2cell([y1,y2,y3] , count);
(As a side note, the use of i
and j
as variable names is not recommended as it may lead to a confusion with the imaginary unit i
and may affect performance. Mathworks recommends to use other variable names, and use 1i
or 1j
when referring to the imaginary unit.)
your first code results in an error, I modified two lines then it work but I cant post the code in a neat way in the comment as ctrl+k does not define the selected line as code here
– N. I. ElZayat
Nov 23 '18 at 13:47
You may use backquotes ` around code snippets in comments. This is also how you put code inline in questions & answers.
– Brice
Nov 23 '18 at 14:23
The modified code is //N=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); Y{kk} = [y1(sel),y2(sel),y3(sel)]; end
// I can not find how to enter new line in the comment??
– N. I. ElZayat
Nov 23 '18 at 14:27
And you will not : you can't enter new line in comments...
– Brice
Nov 23 '18 at 14:57
I got it. As regards running the code in my last comment on the full data set I need to add another command line in the loop to get rid of NAN vectors for unbalanced subjects, the final code that works fine with my full data isN=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); yy = [y1(sel),y2(sel),y3(sel)]; yy(any(isnan(yy), 2), :) = ; Y{kk} = yy; end
– N. I. ElZayat
Nov 23 '18 at 15:41
add a comment |
I'll assume that the input data is contained in 5 vectors called i
, j
, y1
, y2
and y3
. You may use the following code:
% Initialize Y
Y = cell(max(i),1);
% Loop to read
for kk=1:max(i)
sel = (i==kk); % Logical array use to select lines according to i
ind = j(sel); % This is in case the input data is not sorted, we'll know where the data has to go in Y{...}
% Start with last column so that Y{ii} is initialized with the good size
Y{kk}(ind,3) = y3(sel);
Y{kk}(ind,2) = y2(sel);
Y{kk}(ind,1) = y1(sel);
end
If all the data is already sorted by i
& j
, you could use mat2cell
. A loop would still be needed to know the number of lines for each value of i
:
% Initialize Y
count = zeros(max(i),1);
% Loop to count
for kk=1:max(i)
count(kk)=(i==kk);
end
Y = mat2cell([y1,y2,y3] , count);
(As a side note, the use of i
and j
as variable names is not recommended as it may lead to a confusion with the imaginary unit i
and may affect performance. Mathworks recommends to use other variable names, and use 1i
or 1j
when referring to the imaginary unit.)
I'll assume that the input data is contained in 5 vectors called i
, j
, y1
, y2
and y3
. You may use the following code:
% Initialize Y
Y = cell(max(i),1);
% Loop to read
for kk=1:max(i)
sel = (i==kk); % Logical array use to select lines according to i
ind = j(sel); % This is in case the input data is not sorted, we'll know where the data has to go in Y{...}
% Start with last column so that Y{ii} is initialized with the good size
Y{kk}(ind,3) = y3(sel);
Y{kk}(ind,2) = y2(sel);
Y{kk}(ind,1) = y1(sel);
end
If all the data is already sorted by i
& j
, you could use mat2cell
. A loop would still be needed to know the number of lines for each value of i
:
% Initialize Y
count = zeros(max(i),1);
% Loop to count
for kk=1:max(i)
count(kk)=(i==kk);
end
Y = mat2cell([y1,y2,y3] , count);
(As a side note, the use of i
and j
as variable names is not recommended as it may lead to a confusion with the imaginary unit i
and may affect performance. Mathworks recommends to use other variable names, and use 1i
or 1j
when referring to the imaginary unit.)
answered Nov 23 '18 at 10:09
BriceBrice
1,416110
1,416110
your first code results in an error, I modified two lines then it work but I cant post the code in a neat way in the comment as ctrl+k does not define the selected line as code here
– N. I. ElZayat
Nov 23 '18 at 13:47
You may use backquotes ` around code snippets in comments. This is also how you put code inline in questions & answers.
– Brice
Nov 23 '18 at 14:23
The modified code is //N=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); Y{kk} = [y1(sel),y2(sel),y3(sel)]; end
// I can not find how to enter new line in the comment??
– N. I. ElZayat
Nov 23 '18 at 14:27
And you will not : you can't enter new line in comments...
– Brice
Nov 23 '18 at 14:57
I got it. As regards running the code in my last comment on the full data set I need to add another command line in the loop to get rid of NAN vectors for unbalanced subjects, the final code that works fine with my full data isN=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); yy = [y1(sel),y2(sel),y3(sel)]; yy(any(isnan(yy), 2), :) = ; Y{kk} = yy; end
– N. I. ElZayat
Nov 23 '18 at 15:41
add a comment |
your first code results in an error, I modified two lines then it work but I cant post the code in a neat way in the comment as ctrl+k does not define the selected line as code here
– N. I. ElZayat
Nov 23 '18 at 13:47
You may use backquotes ` around code snippets in comments. This is also how you put code inline in questions & answers.
– Brice
Nov 23 '18 at 14:23
The modified code is //N=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); Y{kk} = [y1(sel),y2(sel),y3(sel)]; end
// I can not find how to enter new line in the comment??
– N. I. ElZayat
Nov 23 '18 at 14:27
And you will not : you can't enter new line in comments...
– Brice
Nov 23 '18 at 14:57
I got it. As regards running the code in my last comment on the full data set I need to add another command line in the loop to get rid of NAN vectors for unbalanced subjects, the final code that works fine with my full data isN=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); yy = [y1(sel),y2(sel),y3(sel)]; yy(any(isnan(yy), 2), :) = ; Y{kk} = yy; end
– N. I. ElZayat
Nov 23 '18 at 15:41
your first code results in an error, I modified two lines then it work but I cant post the code in a neat way in the comment as ctrl+k does not define the selected line as code here
– N. I. ElZayat
Nov 23 '18 at 13:47
your first code results in an error, I modified two lines then it work but I cant post the code in a neat way in the comment as ctrl+k does not define the selected line as code here
– N. I. ElZayat
Nov 23 '18 at 13:47
You may use backquotes ` around code snippets in comments. This is also how you put code inline in questions & answers.
– Brice
Nov 23 '18 at 14:23
You may use backquotes ` around code snippets in comments. This is also how you put code inline in questions & answers.
– Brice
Nov 23 '18 at 14:23
The modified code is //
N=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); Y{kk} = [y1(sel),y2(sel),y3(sel)]; end
// I can not find how to enter new line in the comment??– N. I. ElZayat
Nov 23 '18 at 14:27
The modified code is //
N=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); Y{kk} = [y1(sel),y2(sel),y3(sel)]; end
// I can not find how to enter new line in the comment??– N. I. ElZayat
Nov 23 '18 at 14:27
And you will not : you can't enter new line in comments...
– Brice
Nov 23 '18 at 14:57
And you will not : you can't enter new line in comments...
– Brice
Nov 23 '18 at 14:57
I got it. As regards running the code in my last comment on the full data set I need to add another command line in the loop to get rid of NAN vectors for unbalanced subjects, the final code that works fine with my full data is
N=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); yy = [y1(sel),y2(sel),y3(sel)]; yy(any(isnan(yy), 2), :) = ; Y{kk} = yy; end
– N. I. ElZayat
Nov 23 '18 at 15:41
I got it. As regards running the code in my last comment on the full data set I need to add another command line in the loop to get rid of NAN vectors for unbalanced subjects, the final code that works fine with my full data is
N=max(i1); Y = cell(1,N); for kk=1:N sel = (i1==kk); yy = [y1(sel),y2(sel),y3(sel)]; yy(any(isnan(yy), 2), :) = ; Y{kk} = yy; end
– N. I. ElZayat
Nov 23 '18 at 15:41
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53441497%2fread-matrices-as-cell-array-from-long-longitudinal-matlab-data%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The question is not clear. What does the original look like (i.e. what does unbalanced mean)? In what format is it (e.g. text file, Matlab array)? What do you expect as an output? A small example with a few lines of unbalanced input and the expected output will help to understand what you exactly want -- and get a useful answer.
– Brice
Nov 23 '18 at 8:46
Please edit the question, this is not readable in a comment
– Brice
Nov 23 '18 at 9:36
@Brice, I felt it was not readable so I edit the question and tried to clarify. Wish it is clear now. Unbalanced means the matrix of each cell in Y is not of the same size. the first is 5X3, second 3X3 , last is 4X3.
– N. I. ElZayat
Nov 23 '18 at 9:43