String 如何从单元格中提取字符串值,以便检查其数据类型?MatlabQ简介
我的部分任务是测试“studentNames”变量中存储的数据类型 但是我相信,因为String 如何从单元格中提取字符串值,以便检查其数据类型?MatlabQ简介,string,matlab,cell,String,Matlab,Cell,我的部分任务是测试“studentNames”变量中存储的数据类型 但是我相信,因为学生名保存在一个单元格中,而MATLAB无法检测数据类型 我怎样才能解决这个问题 编辑窗口 function [studentCell] =classCellArray(studentNames, studentIDs, studentGrades) studentCell(1,:) = [ **studentNames{1,:}** studentIDs(1,:) studentGrades(1,:) {me
学生名保存在一个单元格中,而MATLAB无法检测数据类型
我怎样才能解决这个问题
编辑窗口
function [studentCell] =classCellArray(studentNames, studentIDs, studentGrades)
studentCell(1,:) = [ **studentNames{1,:}** studentIDs(1,:) studentGrades(1,:) {mean(studentGrades(1,:))}];
studentCell(2,:) = [ studentNames{2,:} studentIDs(2,:) studentGrades(2,:) {mean(studentGrades(2,:))}];
studentCell(3,:) = [ studentNames{3,:} studentIDs(3,:) studentGrades(3,:) {mean(studentGrades(3,:))}];
studentCell(4,:) = [ studentNames{4,:} studentIDs(4,:) studentGrades(4,:) {mean(studentGrades(4,:))}];
命令窗口
studentCell =
'Ali' 'G10293' [1x3 double] [82.6667]
'Yin' 'G10498' [1x3 double] [ 93]
'Bob' 'G10201' [1x3 double] [56.6667]
'Jim' 'G19532' [1x3 double] [ 100]
EDU>>课程(学生姓名)
使用子索引时出错
没有为类“cell”的值定义函数“subindex”。***首先,您调用的函数不正确。您可以通过class(studentCell)
或whos studentCell
查找类。要找出单元结构中的类,只需调用class(studentCell{1})
谢谢您的回答,Gaurav,不过我的教授将通过键入下面的内容来检查我的代码。我可以在我的代码中包含一些允许任何用户找到我的数据类型的类的内容吗?谢谢>>类(学生名)ans=char