storing unknown matrices size in a single matrix

2 ビュー (過去 30 日間)
ayman mounir
ayman mounir 2020 年 9 月 22 日
コメント済み: ayman mounir 2020 年 10 月 5 日
Hello everyone,
I have a structure and I use strcmp(data.step(i).comment) to extract the matrices which have the number of student in every class.
example of my issue: I am storing the number of students in every class, Math Class=20 students, Bioology class=18 students and so on. (students number is not constant)
I want to write a code to store all matrices which have the students numbers in a single matrix or vector.
Thanks in advance.

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 9 月 22 日
編集済み: Ameer Hamza 2020 年 9 月 22 日
If you already have created variable names like that, then you need to concatenate them like this manually
matrix = [math_class, biology, other variables]
  3 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 9 月 22 日
Can you attach your data in a .mat file? It will help in understanding the problem.
ayman mounir
ayman mounir 2020 年 10 月 5 日
I solved I appreciate your help

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 9 月 22 日
Use an array structure similar to
class_identifier1 student_id1
class_identifier1 student_id2
class_identifier1 student_id3
class_identifier2 student_id4
class_identifier2 student_id2 %that is, student2 is in both courses
so for any one course if you have a list of student identifiers, make it into a column vector, and make a column vector that is all the same, all the same class identifier; with this structure you can vertcat() the matrices to form one large matrix and yet still be able to distinguish which data came from which matrix.

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by