Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

cell contents assignment to a non-cell array object

조회 수: 4 (최근 30일)
sharmila velu
sharmila velu 2018년 1월 8일
마감: MATLAB Answer Bot 2021년 8월 20일
clc;
clear all;
close all;
%disp('******************* LMI *******************')
%warning('off','YALMIP:strict') 
global r
yalmip('clear');
r=2;
c1=1;
C=[c1 0 0 0 0 0;
0 c1 0 0 0 0;
0 0 c1 0 0 0;
0 0 0 c1 0 0;
0 0 0 0 c1 0;
0 0 0 0 0 c1];
A{1}=[-0.01 0 0;0 -.05 0;1 .01 0];
A{2}=[0 .01 -0.1;0 0 -1;0 .02 .1];
B{1}=[0;-.02;.01];
B{2}=[0;-.02;.01];
D{1}=[0.01;.002;.001];
D{2}=[-.01;.02;.04];
E{1}=[0 -2 0;2 0 0;1 -.2 0];
E{2}=[0 -1 1;.1 -1 0;1 -1 0];
C{1}=[0 .1 0];  
C{2}=[1 0 .10];
K{1}=[.001 .3 0];
K{2}=[-2 -.03 1];
M{1}=0.01;
M{2}=1.5;
zer=[0 0 0;0 0 0;0 0 0];
zer1=[0;0;0];
L=[1 2 1];
%TildA{1}=[-B{1}*M{1}*C{1} zer; zer -B{1}*M{1}*C{1}];
% define known matrix
for i=1:r
      for j=1:r
TilA{i,j}=[A{i} zer;
      zer A{j}+B{j}*K{j}];
TildA{j}=[-B{j}*M{j}*C{j} zer; zer -B{j}*M{j}*C{j}];
TilB{j}=[-B{j}*M{j} B{j}*M{j}*C{j}; zer1 zer];
TilD{i}=[D{i};zer1];
TilE{i}=[E{i}; zer];
      end
  end
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 1월 9일
편집: Walter Roberson 2018년 4월 13일
Using "clear all" inside a program is like Wile E. Coyote blowing up the butte he is standing on, expecting that he will be safe from falling as long as he does not look down. The only time you should ever use "clear all" inside a program is if you are writing a short script that you intend to be like restarting MATLAB without actually restarting MATLAB.

답변 (1개)

ANKUR KUMAR
ANKUR KUMAR 2018년 1월 9일
C{1}=[0 .1 0];
C{2}=[1 0 .10]; K{1}=[.001 .3 0];
The errors are in these above codes. You already have defined C in double format (as in matrix in the third line). And you are trying to enter in C input as in cell. This is not possible.
My suggestion is to change the above code by
C1{1}=[0 .1 0];
C1{2}=[1 0 .10]; K{1}=[.001 .3 0];
Few more change you should to do are,
TildA{j}=[-B{j}*M{j}*C1{j} zer; zer -B{j}*M{j}*C1{j}];
TilB{j}=[-B{j}*M{j} B{j}*M{j}*C1{j}; zer1 zer];

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by