首次使用matlab进行插值的感悟(萌说新语MATLAB入门学习7)(1)

MATLAB入门学习——元胞组数1

首次使用matlab进行插值的感悟(萌说新语MATLAB入门学习7)(2)

首次使用matlab进行插值的感悟(萌说新语MATLAB入门学习7)(3)

首次使用matlab进行插值的感悟(萌说新语MATLAB入门学习7)(4)

分享兴趣,传播快乐,

增长见闻,留下美好!

亲爱的您,这里是LearningYard学苑。

今天小编为大家带来的主题是MATLAB学习——元胞数组,

欢迎您的用心访问,

本期推文阅读时长大约5分钟,

请您耐心阅读。

Share interest, spread happiness,

Increase knowledge and leave good news!

Dear you, this is LearningYard Academy.

The topic that Xiaobian brings to you today is MATLAB learning - cell array,

Welcome your visit with heart,

This tweet is about 5 minutes long to read.

Please read with patience.

上周我们在确定群体效用值和个体遗憾值的时候用到了“end 1”和矩阵分行操作,这里我们详细对该技巧进行讲解。

假如在该步骤将“end 1”删掉:

Last week we used the "end 1" and matrix branch operations to determine the group utility value and individual regret value. Here we explain the technique in detail.

If you delete "end 1" at this step:

首次使用matlab进行插值的感悟(萌说新语MATLAB入门学习7)(5)

首次使用matlab进行插值的感悟(萌说新语MATLAB入门学习7)(6)

我们能清楚地看到Best_value和Worst_value的数值随着语句的循环一直在发生更替,而且它们的属性变成了1×1的double形式,不再是向量了。

“end 1”具体的工作流程:

首次使用matlab进行插值的感悟(萌说新语MATLAB入门学习7)(7)

它会把数值不断累积,使其变成一个向量。但需要注意的是Best_value和Worst_value这两个变量必须先将其定义为一个空集“[ ]”,否则在end 1步骤中会报错。

It keeps accumulating the values into a vector. But it should be noted that the two variables Best_value and Worst_value must first be defined as an empty set "[ ]", otherwise an error will be reported in the end 1 step.

通过(end 1)指令编码出来的结果都是行向量的形式,如果要将其转化为矩阵,用代码表示为:

The result encoded by the (end 1) instruction is in the form of a row vector. If it is to be converted into a matrix, the code is expressed as:

首次使用matlab进行插值的感悟(萌说新语MATLAB入门学习7)(8)

在这里首先需要定义行向量的规格尺寸,以方便对其分行。然后需要注意的是需要把矩阵现用空集进行表示,否则在for循环中无法识别Test_Matrix。最后在for循环内用change的变量对行向量的内容进行截取,用[Test_Matrix;Test_Matrix_Change]的方式重复对Test_Matrix进行赋值,使其变成矩阵的形式。最终得到的结果如下:

Here, you first need to define the size of the row vector to facilitate its branching. Then it should be noted that the matrix needs to be represented by an empty set, otherwise Test_Matrix will not be recognized in the for loop. Finally, in the for loop, use the variable of change to intercept the content of the row vector, and use the [Test_Matrix;Test_Matrix_Change] method to repeatedly assign values to Test_Matrix to make it into the form of a matrix. The final result is as follows:

首次使用matlab进行插值的感悟(萌说新语MATLAB入门学习7)(9)

今天的分享就到这里了。

如果您对今天的文章有独特的想法,

欢迎给我们留言,让我们相约明天,

祝您今天过得开心快乐!

That's it for today's sharing.

If you have a unique idea for today's article,

Welcome to leave us a message, let us meet tomorrow,

I wish you a great day today!

,