Need a kind soul for help, Changing Cell array data with greater value into another cell array.

조회 수: 2 (최근 30일)
Hello I am very confused and have been using over 5 hours to figure 1 simple task out in matlab.
it is to move or Copy the numbers higher than 230 into a new Column. file attached
here is the data. i can make the data to be either String or Double. so Either works.
please help so the numbers larger than 230 is copied in column next to it. this is so i can make a plot.
thanks alot

답변 (2개)

Joseph Cheng
Joseph Cheng 2014년 3월 18일
편집: Joseph Cheng 2014년 3월 18일
simple enough,
I would suggest using the find() function.
for example:
over230 = find(V>230); %get the index of V where the values are over 230.
V=[V zeros(length(V))]; %need some zero padding as the length of over230 is shorter than V.
V(1:length(over230),2) = V(over230); %copy values V(over230) into second column
  댓글 수: 3
awda
awda 2014년 3월 18일
but this creates another cell, with triple as much data. starting at 1 ending at the value of 11000 which my highest Voltage is 233 or something.
and the errors:
Out of memory. Type HELP MEMORY for your options.
Error in test1 (line 36) V=[V zeros(length(V))]; %need some zero padding as the length of over230 is shorter than V.
Have u tried to run the data i uploaded into ur matlab? maybe my matlab is new or i dont know
Joseph Cheng
Joseph Cheng 2014년 3월 18일
I have ran your V.mat and i have no issue. I would say since it is a memory issue you probably want to switch to 64 bit Matlab if you can. Since all you said was to copy values to second column you did not specify anything more I supplied a solution with very little information. So you still want to keep time sensitive values to your plots yet keep the memory down of only values over 230. Then why don't you try this very simple solution
figure,plot(over230,V(over230))

댓글을 달려면 로그인하십시오.


awda
awda 2014년 3월 18일
By the way when you use the function called find(). u will get the matlab to start from 1 and count upto the value the cell array has. so its not an option?

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by