[Scilab-users] Data Extraction Issue in Scilab

Stéphane Mottelet stephane.mottelet at utc.fr
Thu Mar 14 11:43:57 CET 2013


There is an even simpler manner, allowing to create a struct type 
variable with all fields

fd=mopen('engine.in','r');
s=mgetl(fd);
mclose(fd);
data=struct();
for  i=1:size(s,1)
     w=strsplit(s(i),'/\s+/');
     execstr(sprintf('data.%s=%s',w(2),w(1)));
end

-->data
  data  =
  
    bore: 0.08
    stroke: 0.08
    squish: 0.001671
    conrod: 0.14835
    wrist: 0
    rpm: 4000
    swirl: 1.7
    swirl_profile: 3.11
    zhead: 0
    pist_id: 1
    liner_id: 4
    head_id: 5
    crevice_flag: 0

S.

Le 14/03/13 11:19, Stéphane Mottelet a écrit :
>
> Hello,
>
> this small script solves your problem :
>
> fd=mopen('engine.in','r');
> s=mgetl(fd);
> mclose(fd);
> data1=[];
> for  i=1:size(s,1)
>      w=strsplit(s(i),'/\s+/');
>      for  j=1:size(w,1)
>          data1(i,j)=w(j);
>      end
> end
>
> [r,c]=find(data1=='bore');
> bore=eval(data1(r(1),c(1)-1));
>
> Hope this helps,
>
> S.
>
> Le 14/03/13 05:16, Munian, Devaraj a écrit :
>>
>> Dear Scilab Support,
>>
>> We here in RNTBCI are testing Scilab to compare it against Matlab. We 
>> are doing a pilot project to convert our script in Matlab to Scilab 
>> for validating purpose.
>>
>> If we are able to get the same result in Scilab compared with Matlab, 
>> we will be converting all our Matlab applications into Scilab 
>> applications.
>>
>> During our pilot project which is a most simplest project we are not 
>> able to proceed further because of issues mentioned in the ppt.
>>
>> I have also attached the data files and Matlab files for your reference.
>>
>> It will be really grateful if the issue is addressed at the earliest.
>>
>> Regards
>>
>> *Devaraj* | Assistant Manager | Tools and Methods |
>> *RENAULT NISSAN TECHNOLOGY & BUSINESS CENTRE INDIA PRIVATE LIMITED
>> *Ascendas IT Park, Mahindra World City SEZ | Plot # TP2/1, Natham Sub 
>> Post Office |
>> 3^rd Floor | Chengelpattu | Kancheepuram District | Tamilnadu 603002 
>> | India |
>> Tel #  | + 9144-67416303 |
>> eMail | devaraj.munian at rntbci.com <mailto:devaraj.munian at rntbci.com>|
>>
>> cid:727344808 at 01032012-1EA6**
>>
>> **
>>
>> *T**OGETHER**E**VERYBODY**A**CHIEVES**M**ORE*
>>
>>
>>
>> ***********************************************************************************************************
>> CONFIDENTIALITY NOTICE
>>
>> This message is for the named person's use only.  It may contain 
>> confidential, proprietary or legally privileged information.
>>
>> If you receive this message in error, please immediately delete it 
>> and all copies of it from your system, destroy any hard copies of it 
>> and notify us by email to email.security at rntbci.com with a copy of 
>> this message. You must not, directly or indirectly, use, disclose, 
>> distribute, print or copy any part of this message if you are not the 
>> intended recipient. RNTBCI and any of its subsidiaries each reserves 
>> the right to monitor all e-mail communications through its networks.
>>
>> RNTBCI is neither liable for the proper, complete transmission of the 
>> information contained in this communication nor any delay in its 
>> receipt. This email was scanned for the presence of computer viruses. 
>> In the unfortunate event of infection RNTBCI does not accept any 
>> liability.
>>
>> Any views expressed in this message are those of the individual 
>> sender, except where the message states otherwise and the sender is 
>> authorised to state them.
>> ***********************************************************************************************************
>>
>>
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20130314/70e7a29d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 2099 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20130314/70e7a29d/attachment.gif>


More information about the users mailing list